PHP code example of paydia / paydia-snap-php

1. Go to this page and download the library: Download paydia/paydia-snap-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

paydia / paydia-snap-php example snippets



y code goes here


    use PaydiaSNAP\Config;

    // Set to Enable Sandbox/Production Enviroment. Set to true for Production Environment
    Config::enableProduction(false);

    // Set your Merchant Client Id
    Config::setClientId("<your client id>");
    // Set your Merchant Client Secret
    Config::setClientSecret("<your client secret>");
    // Set your Merchant Private Key. Private Key in String Format, can use https://www.samltool.com/format_privatekey.php for formatting Private Key as String
    Config::setPrivateKey("<your private key>");


    use PaydiaSNAP\Auth;

    // Timestamp in ISO-8601 (Optional Parameter)
    $timestamp = '';

    $accessToken = Auth::getAccessTokenB2b($timestamp);


    use PaydiaSNAP\Mpm;

    // Access Token from Access Token B2B
    $accessToken = '';
    // Request Generate QR MPM, see documentation for detail request
    $request = array(
        ...
    );
    // External Id Request (Optional Parameter)
    $externalId = '';
    // Timestamp in ISO-8601 (Optional Parameter)
    $timestamp = '';

    // Request Generate QR MPM
    $generateQr = Mpm::generateQr($accessToken, $request, $externalId, $timestamp);

    // Request Status Inquiry
    $checkStatus = Mpm::checkStatusQr($accessToken, $request, $externalId, $timestamp);

composer 
json
{
    "aydia/paydia-snap-php": "1.*"
    }
}