1. Go to this page and download the library: Download oktocode/sham-cash-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/ */
oktocode / sham-cash-sdk example snippets
use OkToCode\ShamCash\Client;
use OkToCode\ShamCash\Enum\Currency;
$client = new Client(
agentKey: getenv('SHAMCASH_AGENT_KEY'),
secretKey: getenv('SHAMCASH_SECRET_KEY'),
baseUrl: getenv('SHAMCASH_BASE_URL'),
callbackUrl: 'https://agent.example/webhooks/shamcash',
redirectUrl: 'https://agent.example/checkout/return',
);
$page = $client->listTransactions('2026-01-01', '2026-01-20', afterTranId: 0, limit: 1000);
foreach ($client->eachTransaction('2026-01-01', '2026-01-20', limit: 1000) as $transaction) {
// $transaction->tranType is payment or refund when the type id is known.
}
use OkToCode\ShamCash\Enum\BillStatus;
use OkToCode\ShamCash\Exception\CryptoException;
$rawBody = file_get_contents('php://input');
try {
$event = $client->parseWebhook($rawBody);
} catch (CryptoException) {
http_response_code(400);
exit;
}
if ($event->status === BillStatus::Paid) {
// $event->tranId is the ShamCash payment id.
// fulfillOrder($event->billNo, $event->tranId);
} elseif ($event->status === BillStatus::Expired) {
// $event->tranId is null. The customer did not pay within 10 minutes.
// releaseOrder($event->billNo);
}
http_response_code(200);