1. Go to this page and download the library: Download surepay-one/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/ */
surepay-one / sdk example snippets
use SurePay\SurePay;
use SurePay\Request\CreateDepositRequest;
use SurePay\Request\CreatePayoutRequest;
$client = SurePay::builder(
getenv('SUREPAY_API_KEY'), // tpay_live_... or tpay_test_...
getenv('SUREPAY_API_SECRET'), // tpay_sec_... — enables auto HMAC signing
)->build();
// Check wallet balance
$balance = $client->balance->get();
echo "Available: {$balance->available} VND\n";
// Create a deposit order (thu hộ)
$deposit = $client->deposits->create(
CreateDepositRequest::builder(100_000)
->withRequestId('ORD-20260610-001')
->build()
);
echo "Checkout URL: {$deposit->checkoutUrl}\n";
// Create a payout (chi hộ)
try {
$payout = $client->payouts->create(
CreatePayoutRequest::builder(500_000, 'VCB', '1234567890', 'NGUYEN VAN A', 'Salary June 2026')
->build()
);
echo "Payout ID: {$payout->id}\n";
} catch (SurePayException $e) {
if ($e->isInsufficientBalance()) {
echo "Not enough balance — top up first\n";
}
}
$client = SurePay::builder($apiKey, $apiSecret)
->baseUrl('https://api.surepay.one/merchant/v1') // override for local/staging
->timeout(15) // seconds
->maxRetries(3) // retries on 5xx and network errors
->build();
$balance = $client->balance->get();
// $balance->balance — total wallet balance in VND
// $balance->hold — reserved for in-flight transactions
// $balance->available — balance - hold
// $balance->currency — always "VND"
use SurePay\Params\DepositsListParams;
$result = $client->deposits->list(
DepositsListParams::create()
->page(1)
->pageSize(20)
->status('success') // pending|processing|success|failed|expired|cancelled
->fromDate('2026-06-01') // YYYY-MM-DD
->toDate('2026-06-30')
);
// $result->items — Deposit[]
// $result->total — total matching records
// $result->totalPages — total pages
use SurePay\Request\CreateDepositRequest;
$deposit = $client->deposits->create(
CreateDepositRequest::builder(100_000) // amount in VND, al:
->withSenderBankId('970436')
->withSenderBankName('Vietcombank')
->withSenderAccount('1234567890')
->withSenderName('NGUYEN VAN A')
->build()
);
echo $deposit->checkoutUrl;
echo $deposit->qrCode;
use SurePay\Request\CreatePayoutRequest;
$payout = $client->payouts->create(
CreatePayoutRequest::builder(
500_000, // amount in VND, name in UPPERCASE,