PHP code example of rpay / prestashop-pokpay-payments-sdk

1. Go to this page and download the library: Download rpay/prestashop-pokpay-payments-sdk 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/ */

    

rpay / prestashop-pokpay-payments-sdk example snippets





reate the configuration for the API calls
// getDefaultConfiguration accepts a parameter to specify whether the production environment is used
// By default the staging environment is used
// The same configuration is later used for all the other API classes
$config = RPay\POK\PaymentsSdk\Configuration::getDefaultConfiguration(true);

$apiInstance = new RPay\POK\PaymentsSdk\Api\AuthApi(
    $config,
    new GuzzleHttp\Client(),
);

$keyId = 'PokPay Key Id';
$keySecret = 'PokPay Key Secret';

$payload = new \RPay\POK\PaymentsSdk\Model\LoginSdkPayload($keyId, $keySecret); // \RPay\POK\PaymentsSdk\Model\LoginSdkPayload

try {
    $result = $apiInstance->login($payload);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthApi->login: ', $e->getMessage(), PHP_EOL;
}