PHP code example of stack-pay / payments-sdk-php

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

    

stack-pay / payments-sdk-php example snippets






$stackpay = new StackPay\Payments\StackPay($yourPublicKey, $yourPrivateKey);

$stackpay->enableTestMode();

$stackpay->setCurrency('CAD');

$response = $request->send();

echo $response->body()->ID;

$response = $request->send();

if (! $response->success()) {
    echo $response->error()->code."\n"; // the API response error code
    echo $response->error()->message."\n"; // the API response error message
    print_r($response->error()->errors); // populated when the request body does not pass validation
}