1. Go to this page and download the library: Download tokenpay-platform/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/ */
tokenpay-platform / sdk-php example snippets
TokenPay\SDK\TokenPay;
$tokenpay = new TokenPay(getenv('TOKENPAY_API_KEY'));
// Create a payment (currency, amount in the smallest unit, optional metadata).
$payment = $tokenpay->payments->create([
'currency' => 'AUD',
'amount' => 12500, // A$125.00
'metadata' => ['order_id' => 'WC-1234'],
]);
echo $payment['id']; // pay_...
echo $payment['checkout_url']; // https://merchant.tokenpayment.io/pay/...
$tokenpay->payments->get($payment['id']);
$tokenpay->payments->list([
'status' => 'matched',
'from_date' => '2026-04-01T00:00:00Z',
'limit' => 50,
'offset' => 0,
]);
// Cancel a payment that is still in `created` or `matching` state.
$tokenpay->payments->cancel($payment['id']);