00Getting started
Arizu Pay API
Arizu Pay is the payment gateway for every app run by Arizu Studio. Your app sets the price, Arizu Pay hosts the checkout page and talks to the payment gateways (Duitku, iPaymu and DOKU), and your app hears back through webhooks and the API. Your app never handles gateway keys or card or bank data.
Base URL: https://arizu.id/api/pay/v1, the same for sandbox and production. Your key decides the mode.
Machine-readable copy of this page: https://arizu.id/pay/docs/markdown. The docs are public. Your app key and secret are not: keep them on your server.
-
1
Your server to Arizu Pay
POST /paymentswith the order and the amount -
2
Arizu Pay to Your server
A payment object with its
checkout_url -
3
Your server to Customer
Your site sends the browser to the
checkout_url - 4 Customer to Arizu Pay The customer picks a method on the checkout
- 5 Arizu Pay to Gateway Arizu Pay opens the transaction at Duitku or iPaymu
- 6 Customer to Gateway The customer pays by VA, QRIS or e-wallet
- 7 Gateway to Arizu Pay The gateway reports it, and Arizu Pay checks it again
-
8
Arizu Pay to Your server
Webhook
payment.paid, signed with your secret -
9
Arizu Pay to Customer
"Payment received", then back to your
return_url
01Getting started
03Reference
01.1Getting started
How a payment works
- Your server calls
POST /paymentswith theorder_id, theamountin rupiah and what is being bought. - Arizu Pay answers with a
paymentobject that has acheckout_url. Send the customer's browser there. - On the checkout page the customer picks a payment method (virtual account, QRIS, e-wallet, retail counter, card). Arizu Pay creates the transaction at the gateway of that method and shows the number, the QR code or the provider page.
- When the customer pays, the gateway tells Arizu Pay. Arizu Pay checks the payment with the gateway again, marks it
paidand sendspayment.paidto your webhook URL. - The customer sees "Payment received" and returns to your
return_url. - Your webhook handler fulfils the order (for example, adds the top-up balance) exactly once.
- Unpaid payments become
expiredwhenexpires_atpasses, and you getpayment.expired.
01.2Getting started
Sandbox and production
Every app has two modes. They use the same base URL and the same code. Only the three values in your server config change.
| Mode | Keys start with | Payments go to | Money |
|---|---|---|---|
| Sandbox | ak_sandbox_, sk_sandbox_ | The sandbox of the gateway in use (Duitku, iPaymu or DOKU) | None. Pay with the gateway's sandbox simulator. |
| Production | ak_production_, sk_production_ | The gateway in use (Duitku, iPaymu or DOKU) | Real money |
The two modes are fully separate:
- A sandbox key cannot see production payments, and the other way round.
- The same
order_idcan exist in both modes. - Each mode has its own webhook URL, webhook secret, allowed return hosts and IP allowlist.
- Each mode has its own rate limit.
GET /ping tells you which mode a key is in.
Build and test everything with the sandbox key. To go live, swap in the production values. Nothing else changes.
01.3Getting started
Before you start
An admin creates your app in the Arizu office under Payments › Apps. The app gets a sandbox key and a production key. For each mode you receive three values. The secret key and the webhook secret are shown only once, so store them right away:
| Value | Example | Where it goes |
|---|---|---|
| App key | ak_sandbox_3h9k... | The X-Arizu-Key header. It is not secret, but keep it server-side. |
| Secret key | sk_sandbox_... | Signs every API request. Keep it server-side only, never in a browser or mobile app. |
| Webhook secret | whsec_... | Proves that a webhook really came from Arizu Pay. Each mode has its own. |
Keep them in server config, for example:
ARIZU_PAY_KEY=ak_sandbox_...
ARIZU_PAY_SECRET=sk_sandbox_...
ARIZU_PAY_WEBHOOK_SECRET=whsec_...For each mode, the app page in the office also lists:
- Allowed return hosts: the hosts your
return_urlmay use, for examplekotagames.my.idor*.kotagames.my.id. The app website's host is always allowed. Sandbox return URLs may usehttp://, for examplelocalhost:8000. - Webhook URL: where Arizu Pay POSTs events. Production webhooks need
https://. Sandbox webhooks may usehttp://, but the URL must be reachable from the internet. Private addresses such aslocalhostare refused, so use a tunnel while you develop. - An optional IP allowlist for API calls.
An app can have up to 5 active keys per mode. An admin can create a new key at any time and revoke an old one. See Changing keys.
01.4Getting started
Authentication
Every request carries four headers:
| Header | Value |
|---|---|
X-Arizu-Key | Your app key |
X-Arizu-Timestamp | Current Unix time in seconds. It must be within 5 minutes of the server clock. |
X-Arizu-Nonce | 16 to 64 random characters from A-Z a-z 0-9 _ -, new for every request. A repeated nonce is refused. |
X-Arizu-Signature | Lowercase hex HMAC-SHA256 of the string to sign, keyed with your secret key |
POST requests also send Content-Type: application/json.
The string to sign is five lines joined with \n (no trailing newline):
METHOD
PATH_AND_QUERY
TIMESTAMP
NONCE
SHA256_HEX_OF_BODYMETHODis upper case, such asGETorPOST.PATH_AND_QUERYis exactly what you put in the request line, starting with/api/pay/v1, for example/api/pay/v1/payments?order_id=TOPUP-1001. Encode the query once, then sign and send that same string.SHA256_HEX_OF_BODYis the lowercase hex SHA-256 of the exact body bytes you send. For a GET request it is the hash of an empty string:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.
A small PHP client that does all of this:
final class ArizuPay
{
private $key;
private $secret;
private $origin;
public function __construct(string $key, string $secret, string $origin = 'https://arizu.id')
{
$this->key = $key;
$this->secret = $secret;
$this->origin = rtrim($origin, '/');
}
public function call(string $method, string $path, ?array $body = null): array
{
$method = strtoupper($method);
$uri = '/api/pay/v1' . $path;
$json = $body === null ? '' : json_encode($body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$ts = (string) time();
$nonce = bin2hex(random_bytes(16));
$toSign = $method . "\n" . $uri . "\n" . $ts . "\n" . $nonce . "\n" . hash('sha256', $json);
$headers = [
'Accept: application/json',
'X-Arizu-Key: ' . $this->key,
'X-Arizu-Timestamp: ' . $ts,
'X-Arizu-Nonce: ' . $nonce,
'X-Arizu-Signature: ' . hash_hmac('sha256', $toSign, $this->secret),
];
$ch = curl_init($this->origin . $uri);
$opts = [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => $method, CURLOPT_TIMEOUT => 30, CURLOPT_CONNECTTIMEOUT => 10];
if ($method !== 'GET') {
$headers[] = 'Content-Type: application/json';
$opts[CURLOPT_POSTFIELDS] = $json;
}
$opts[CURLOPT_HTTPHEADER] = $headers;
curl_setopt_array($ch, $opts);
$raw = curl_exec($ch);
$status = (int) curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($raw === false) {
throw new RuntimeException('Arizu Pay is unreachable: ' . curl_error($ch));
}
$data = json_decode($raw, true);
if (!is_array($data)) {
throw new RuntimeException('Arizu Pay answered HTTP ' . $status . ' without JSON.');
}
return ['status' => $status] + $data;
}
}Check your setup with GET /ping. It answers {"ok":true,"app":{...},"mode":"sandbox","gateway":"sandbox"}:
modeis the mode of your key:sandboxorproduction.gatewaysays where the payments go:production,sandbox,simulatororunavailable.
01.5Getting started
Responses and errors
Successful responses have "ok": true plus the data. Failed ones look like this:
{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Some fields need attention.",
"fields": { "amount": "The minimum amount is 10000 IDR." }
}
}| HTTP | error.code | Meaning |
|---|---|---|
| 400 | invalid_json | The body is not a JSON object. |
| 401 | invalid_key, key_revoked, bad_signature, stale_request, bad_nonce, replayed | Authentication failed. The message says which part. key_revoked means an admin revoked this key, so switch to the new one. |
| 403 | app_disabled, ip_not_allowed | The app is turned off, or your IP is not on its allowlist. |
| 404 | not_found | No such payment for this app, or no such endpoint. |
| 409 | order_exists | The order_id already exists with a different amount. |
| 409 | not_pending | The payment is no longer pending, so it cannot be cancelled. |
| 413 | too_large | The body is over 64 KB. |
| 422 | invalid_request | Validation failed. fields says which fields. |
| 429 | rate_limited | Over 240 requests a minute for this app in this mode. Wait for Retry-After seconds. |
| 503 | payments_paused | Arizu Pay is not taking new payments in this mode right now. Show the customer that payment is unavailable and try again later. GET /ping answers "gateway": "paused" while this lasts. |
| 503 | gateway_unavailable, unavailable | Payments are not available in this mode yet, or the service is busy. Retry later. |
| 500 | server_error | Unexpected error, already logged on our side. Retry with backoff. |
02.1Endpoints
Create a payment
POST/api/pay/v1/payments
| Field | Type | Required | Notes |
|---|---|---|---|
order_id | string | yes | Your own reference, 1 to 64 characters from A-Z a-z 0-9 . _ : / -. It must be unique per app and mode, so sandbox and production can reuse the same ids. |
amount | integer | yes | Whole rupiah, from 10000 to 100000000. This is what the customer owes you, before any payment fee. |
description | string | no | Up to 255 characters, shown on the checkout. Defaults to "Order {order_id}". |
items | array | no | Up to 50 items of { "name", "price", "quantity" }. price is whole rupiah and quantity is 1 to 1000. price × quantity summed must equal amount. |
customer | object | no | { "name", "email", "phone" }. name is up to 100 characters and email up to 50. The gateways need an email: when you leave it out, the Arizu support address is used. iPaymu also needs a phone number: when you leave it out, the Arizu support number is used. |
return_url | string | no | Where the customer goes after paying or giving up. It must be on one of your allowed return hosts. Defaults to your app website. |
expires_in | integer | no | Minutes the customer has to pay, from 5 to 1440. Default 60. Some methods cap the time for their own transaction: Duitku QRIS and ShopeePay at 60 and cards at 30, iPaymu QRIS at 5, BRI VA at 120 and BSI VA at 180. The customer can pick the method again for a fresh one. |
channels | array | no | Limit this payment to some method codes, such as ["BC","M2","NQ"]. See Payment methods. |
metadata | object | no | Your own data, up to 4000 bytes of JSON. Returned unchanged in every payment object and webhook. |
{
"order_id": "TOPUP-1001",
"amount": 50000,
"description": "Top-up 500 Koin",
"items": [{ "name": "500 Koin", "price": 50000, "quantity": 1 }],
"customer": { "name": "Budi", "email": "budi@example.com", "phone": "081234567890" },
"return_url": "https://kotagames.my.id/topup/return?order=TOPUP-1001",
"expires_in": 60,
"metadata": { "user_id": 4821, "package": "koin-500" }
}The answer is 201 Created with {"ok": true, "existing": false, "payment": {...}}.
The call is safe to retry. If the same order_id already exists with the same amount, you get 200 with "existing": true and the original payment, so a network timeout never creates a second payment. A different amount returns 409 order_exists.
02.2Endpoints
Get a payment
GET /payments/{id}, where{id}is the payment id such aspay_7k2m....GET /payments?order_id=TOPUP-1001looks a payment up by your ownorder_id.
Both answer {"ok": true, "payment": {...}}. A pending payment whose time has passed is expired at that moment, so the status you read is always current.
02.3Endpoints
List payments
GET/api/pay/v1/payments?status=paid&limit=50
| Query | Notes |
|---|---|
status | pending, paid, expired or cancelled |
limit | 1 to 100, default 20 |
starting_after | A payment id. Returns older payments, for paging. |
created_from, created_to | Dates such as 2026-11-01 or ISO 8601 times |
The answer is {"ok": true, "data": [payment, ...], "has_more": false}, newest first. Only payments in the same mode as your key are listed.
02.4Endpoints
Cancel a payment
POST /payments/{id}/cancel with an optional body { "reason": "Customer changed their mind" }.
Only pending payments can be cancelled. You get payment.cancelled on your webhook. If the customer already has a virtual account number and still pays it, the money is recorded and you get payment.paid with flag: "paid_after_cancelled".
The customer can also cancel a pending payment from the payment page, under "Cancel this payment". Arizu Pay first asks the gateway whether the money already arrived. If it did, the payment becomes paid, not cancelled. Otherwise you get the same payment.cancelled webhook, and the page offers a link back to your return_url.
03.1Reference
The payment object
{
"id": "pay_7k2m4q9x1v8b3n6c5z0t2w",
"object": "payment",
"order_id": "TOPUP-1001",
"mode": "sandbox",
"status": "pending",
"amount": 50000,
"fee": 4000,
"total": 54000,
"currency": "IDR",
"description": "Top-up 500 Koin",
"items": [{ "name": "500 Koin", "price": 50000, "quantity": 1 }],
"channel": "BC",
"channel_name": "BCA Virtual Account",
"instructions": {
"type": "va",
"channel": "BC",
"amount": 54000,
"va_number": "7007014001234567",
"payment_code": null,
"qr_string": null,
"pay_url": "https://sandbox.duitku.com/topup/topupdirectv2.aspx?ref=...",
"reference": "DS1234526JQ3WXY",
"expires_at": "2026-11-04T15:30:00+07:00"
},
"checkout_url": "https://arizu.id/pay/Qm9vb...",
"return_url": "https://kotagames.my.id/topup/return?order=TOPUP-1001",
"metadata": { "user_id": 4821, "package": "koin-500" },
"flag": null,
"risk": { "score": 15, "level": "low", "signals": ["timezone_mismatch"] },
"customer": { "name": "Budi", "email": "budi@example.com", "phone": "081234567890" },
"expires_at": "2026-11-04T15:30:00+07:00",
"paid_at": null,
"created_at": "2026-11-04T14:30:00+07:00",
"updated_at": "2026-11-04T14:31:12+07:00"
}| Field | Notes |
|---|---|
mode | sandbox or production, the mode of the key that created the payment |
amount | What you asked for. Credit the customer for this. |
fee | The payment fee the customer pays on top, for the chosen method. It is 0 when the merchant carries the fee. |
total | amount + fee, what the customer is charged |
channel, instructions | Empty until the customer picks a method. instructions.type is va, qris, code (pay at a counter) or redirect (finish on the provider page). |
checkout_url | The hosted page. You can send the customer back to it at any time while the payment is pending. |
flag | Usually null. Otherwise it means someone should look at the payment: paid_after_expired, paid_after_cancelled, duplicate_payment (paid twice; refund one) or amount_mismatch (the gateway reported a different amount; it is not marked paid). |
risk | null until the customer opens the checkout. Then score (0 to 100), level (low under 25, medium under 50, high from 50) and signals. See Fraud signals. |
| Status | Meaning |
|---|---|
pending | Waiting for the customer. They may change methods while it is pending. |
paid | The money arrived and the gateway confirmed it. This is final. |
expired | Time ran out before payment. |
cancelled | You, an admin or the customer cancelled it. |
Treat paid as the only status that releases goods. In rare cases a customer pays a virtual account at the last second, so paid can follow expired or cancelled. Handle payment.paid even for an order you already marked as failed: credit it, or refund it from your side.
03.2Reference
Fraud signals
When the customer opens the checkout, Arizu Pay records the visit: the IP address with its country and network (from IPinfo), the browser, the screen, the time zone, WebGL and other device details. It scores each visit, and the payment object carries the highest score in risk. The score updates while the payment is pending, so read it from the payment.paid webhook or with GET /payments/{id}.
| Signal | Points | Meaning |
|---|---|---|
automation | 40 | The browser says it is driven by automation. |
headless | 35 | A headless browser or a software graphics renderer. |
hosting_ip | 25 | The IP belongs to a data centre, hosting or VPN network. |
shared_device | 20 | The same device paid with 3 or more different customer emails in 7 days. |
timezone_mismatch | 15 | The device time zone does not fit the IP country. |
ua_mismatch | 15 | The browser's user agent and its own platform data disagree. |
busy_ip | 15 | More than 10 payments were opened from the IP in the last hour. |
foreign_ip | 10 | The IP is outside Indonesia. |
odd_browser | 10 | Browser details do not add up, such as no languages or a zero-size screen. |
no_browser_data | 10 | The page opened but the browser sent no details. |
The score is advice, not a verdict. Arizu Pay never blocks a payment because of it. For low-value top-ups you can ignore it. For valuable goods, hold high payments for a manual check before you release them. Admins see the full details on the payment page in the office.
03.3Reference
Payment methods
GET /channels?amount=50000 lists the methods that are turned on, with the fee and the total for that amount:
{
"ok": true,
"amount": 50000,
"channels": [
{ "code": "BC", "name": "BCA Virtual Account", "group": "va", "type": "va", "fee": 4000, "total": 54000, "image": "https://images.duitku.com/hotlink-ok/BC.PNG" },
{ "code": "NQ", "name": "QRIS (Nobu)", "group": "qris", "type": "qris", "fee": 350, "total": 50350, "image": null }
]
}You do not need this call to take payments, because the checkout page shows the methods itself. Use it if you want to show prices on your own page, or to build a channels list for a payment.
The Arizu office decides which methods are on and how much each one costs, and whether the customer or the merchant pays the fee. Known codes:
| Group | Codes |
|---|---|
| Virtual account | BC BCA, M2 Mandiri, I1 BNI, BR BRI, BT Permata, B1 CIMB Niaga, BV BSI, DM Danamon, VA Maybank, A1 ATM Bersama, AG Artha Graha, NC Neo Commerce, S1 Sahabat Sampoerna |
| QRIS | NQ Nobu, SP ShopeePay, SQ Nusapay |
| E-wallet | DA DANA, OV OVO, SA ShopeePay, LA and LF LinkAja |
| Retail | FT Alfamart, Pegadaian and Pos, IR Indomaret |
| Other | VC card, DN Indodana, AT Atome, JP Jenius Pay |
03.4Reference
Webhooks
Arizu Pay POSTs a JSON event to your webhook URL whenever a payment changes:
| Event | When |
|---|---|
payment.pending | The customer picked a method, so instructions are ready. Sent again each time they switch methods. |
payment.paid | The payment is paid. Fulfil the order now. |
payment.expired | Time ran out unpaid. |
payment.cancelled | The payment was cancelled. |
ping | A test from the office or from POST /webhooks/test. |
POST /your/webhook HTTP/1.1
Content-Type: application/json
User-Agent: ArizuPay-Webhook/1.0
X-Arizu-Event: payment.paid
X-Arizu-Delivery: evt_5b1x...
X-Arizu-Timestamp: 1793750000
X-Arizu-Signature: t=1793750000,v1=6d2f...
{"id":"evt_5b1x...","type":"payment.paid","created_at":"2026-11-04T14:36:02+07:00","mode":"sandbox","data":{ ...payment object... }}Check every webhook before you trust it. The v1 value is the lowercase hex HMAC-SHA256 of TIMESTAMP + "." + RAW_BODY, keyed with the webhook secret of that mode. The mode field in the body tells you which mode sent the event. A server that only runs one mode can reject events from the other one:
$raw = file_get_contents('php://input');
$header = $_SERVER['HTTP_X_ARIZU_SIGNATURE'] ?? '';
if (!preg_match('/^t=(\d+),v1=([a-f0-9]{64})$/', $header, $m)
|| abs(time() - (int) $m[1]) > 300
|| !hash_equals(hash_hmac('sha256', $m[1] . '.' . $raw, getenv('ARIZU_PAY_WEBHOOK_SECRET')), $m[2])) {
http_response_code(400);
exit('bad signature');
}
$event = json_decode($raw, true);
$payment = $event['data'];
if ($event['type'] === 'payment.paid') {
// In one database transaction, lock the order row with $payment['order_id'].
// Check that $payment['amount'] equals the price you stored.
// If the order is not fulfilled yet, fulfil it and mark it paid. Otherwise do nothing.
}
http_response_code(200);
echo 'ok';Delivery rules:
- Answer with any 2xx status within 10 seconds. Do slow work after you answer, or in a queue.
- Failed deliveries are retried after 1 minute, 5 minutes, 15 minutes, 1 hour, 3 hours, 6 hours, 12 hours and 24 hours, then marked failed. An admin can resend them from the office.
- The same event can arrive more than once, and events can arrive out of order. Use
idto skip events you have already handled. Let the payment'sstatusand your own order state decide what to do, not the order the events arrived in. - If in doubt, call
GET /payments/{id}. The API is always the source of truth.
POST /webhooks/test sends a ping to your webhook URL right away and returns {"ok":true,"delivered":true,"http_status":200,"error":null}.
03.5Reference
Returning to your site
After a payment, or when it expires, the checkout links back to your return_url with three query parameters:
https://kotagames.my.id/topup/return?order=TOPUP-1001&arizu_payment=pay_7k2m...&order_id=TOPUP-1001&status=paidThese are for display only, because anyone can edit a URL. On the return page, read the payment with GET /payments/{id} (or by order_id). Show "Payment received" only when the API says paid. Your webhook handler normally fulfils the order before the customer gets back. If the return page sees paid first, call the same idempotent fulfil function.
04.1Going live
Paying in the sandbox
Sandbox payments go to the sandbox of the gateway that runs the chosen method. For Duitku:
- The checkout shows a "Sandbox" bar, so nobody mistakes it for a real payment.
- Pay virtual accounts and QRIS with the Duitku sandbox simulator.
- The test cards are VISA
4000 0000 0000 0044and Mastercard5500 0000 0000 0004, valid until 03/33 with CVV 123. - Duitku then sends its callback, and your sandbox webhook receives
payment.paidexactly as it would in production.
For DOKU, the checkout sends the customer to DOKU's sandbox page for the chosen method. Pay the virtual account or payment code shown there with the DOKU sandbox simulator.
If Arizu Pay has no sandbox keys for any gateway, sandbox payments run in the built-in simulator instead. The checkout then shows "Simulate a successful payment" and "Simulate a failed payment".
04.2Going live
Changing keys
An admin can create a new key for either mode at any time under Payments › Apps. To switch keys without downtime:
- Create the new key and give it a label, such as "Live server".
- Put the new key and secret in your server config and deploy.
- Revoke the old key. Requests signed with it fail at once with
401 key_revoked.
The webhook secret is replaced separately, one mode at a time. The new secret signs webhooks right away, so update your config straight after.
04.3Going live
Integration checklist for a top-up shop
This is the recipe for an app such as kotagames.my.id:
- Ask an admin for an app with your website. Ask them to set the sandbox webhook URL and return hosts. Put the three sandbox values in server-side config:
ARIZU_PAY_KEY,ARIZU_PAY_SECRETandARIZU_PAY_WEBHOOK_SECRET. - When a player buys a package, create your own top-up row with status
pending, a unique order id (for exampleTOPUP-<row id>) and the price from your own price list. Never take the price from the browser. - Call
POST /paymentswith that order id, amount, items, customer,return_urlandmetadata. Savepayment.idon the row, then redirect the player topayment.checkout_url. - Build the webhook endpoint as shown above. On
payment.paid, lock the row, check the amount, add the balance once and set the row topaid. Onpayment.expiredorpayment.cancelled, set the row tofailedonly if it is stillpending. - Build the return page: read the payment from the API and show the result. Offer a "Pay now" button with
checkout_urlwhile it is stillpending. - Optional but recommended: every 10 minutes, ask
GET /payments/{id}about rows that have beenpendingfor more than 15 minutes, in case a webhook was missed. - Test in the sandbox:
- one successful payment;
- one failed payment followed by a different method;
- one expired payment, created with
expires_in: 5; - a webhook that answers 500 the first time, which should be retried.
- To go live, ask the admin to set the production webhook URL and return hosts. Swap the three values for the production ones. Nothing else changes.
GET /pingshould now answer"mode":"production".
04.4Going live
Limits and security
- 240 API requests a minute per app and mode. The body can be at most 64 KB, and
metadataat most 4000 bytes. - Keep the secret key and the webhook secret on your server. Never put them in JavaScript, a mobile app or a public repository. If one leaks, an admin creates a new key and revokes the old one, which stops working immediately.
- Never use production keys on a development machine. The sandbox exists for that.
- All traffic is HTTPS. Requests are signed, timestamped and single-use, so a captured request cannot be replayed.
- Arizu Pay stores customer names, emails and phone numbers encrypted.
- Amounts are whole rupiah. Currency is always
IDR.

