Gaya sederhana — cocok untuk toko online
https://toko.com/callback.php)POST /api/pay.php
Header: X-API-Key: API_KEY_ANDA
Content-Type: application/json
{
"ref": "ORD123",
"amount": 50000,
"customer": "budi",
"channel": "QRIS",
"sign": "md5(ref + amount + customer + SECRET_KEY)"
}
Response: pay_url → redirect customer ke sana
GET
/api/status.php?key=API_KEY&ref=ORD123
status: pending | success | failed
POST /api/wd.php
Header: X-API-Key: API_KEY_ANDA
{
"ref": "WD001",
"amount": 100000,
"name": "Budi Santoso",
"number": "1234567890",
"bank": "BCA",
"sign": "md5(ref + amount + number + SECRET_KEY)"
}
GET /api/saldo.php?key=API_KEY
<?php $api_key = 'demo_auth_key_123'; $secret = 'demo_secret_key_456'; $base = 'https://domain-gateway-anda.com'; $ref = 'ORD' . time(); $amount = 50000; $customer = '[email protected]'; $sign = md5($ref . $amount . $customer . $secret); $ch = curl_init($base . '/api/pay.php'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode([ 'ref' => $ref, 'amount' => $amount, 'customer' => $customer, 'channel' => 'QRIS', 'sign' => $sign, ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-Key: ' . $api_key, ], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true); curl_close($ch); if (!empty($res['pay_url'])) { header('Location: ' . $res['pay_url']); // arahkan customer bayar exit; } echo $res['message'] ?? 'Gagal';
Saat bayar sukses, kami POST ke Callback URL Anda:
{
"transaction_id": "ORD123",
"amount": 50000,
"status": 1,
"fee_amount": 350,
"net_amount": 49650,
"signature": "..."
}
status: 1 = sukses bayar → update order toko jadi lunas