Pay

Arizu Pay API v1

Base URLhttps://arizu.id/api/pay/v1

One address for sandbox and production. The key decides the mode.

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.

How the money movesNine steps, from your server to the gateway and back. Each step opens its part of the docs.
  1. 1 Your server to Arizu Pay POST /payments with the order and the amount
  2. 2 Arizu Pay to Your server A payment object with its checkout_url
  3. 3 Your server to Customer Your site sends the browser to the checkout_url
  4. 4 Customer to Arizu Pay The customer picks a method on the checkout
  5. 5 Arizu Pay to Gateway Arizu Pay opens the transaction at Duitku or iPaymu
  6. 6 Customer to Gateway The customer pays by VA, QRIS or e-wallet
  7. 7 Gateway to Arizu Pay The gateway reports it, and Arizu Pay checks it again
  8. 8 Arizu Pay to Your server Webhook payment.paid, signed with your secret
  9. 9 Arizu Pay to Customer "Payment received", then back to your return_url

01.1Getting started

How a payment works

  1. Your server calls POST /payments with the order_id, the amount in rupiah and what is being bought.
  2. Arizu Pay answers with a payment object that has a checkout_url. Send the customer's browser there.
  3. 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.
  4. When the customer pays, the gateway tells Arizu Pay. Arizu Pay checks the payment with the gateway again, marks it paid and sends payment.paid to your webhook URL.
  5. The customer sees "Payment received" and returns to your return_url.
  6. Your webhook handler fulfils the order (for example, adds the top-up balance) exactly once.
  7. Unpaid payments become expired when expires_at passes, and you get payment.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.

ModeKeys start withPayments go toMoney
Sandboxak_sandbox_, sk_sandbox_The sandbox of the gateway in use (Duitku, iPaymu or DOKU)None. Pay with the gateway's sandbox simulator.
Productionak_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_id can 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:

ValueExampleWhere it goes
App keyak_sandbox_3h9k...The X-Arizu-Key header. It is not secret, but keep it server-side.
Secret keysk_sandbox_...Signs every API request. Keep it server-side only, never in a browser or mobile app.
Webhook secretwhsec_...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_url may use, for example kotagames.my.id or *.kotagames.my.id. The app website's host is always allowed. Sandbox return URLs may use http://, for example localhost:8000.
  • Webhook URL: where Arizu Pay POSTs events. Production webhooks need https://. Sandbox webhooks may use http://, but the URL must be reachable from the internet. Private addresses such as localhost are 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:

HeaderValue
X-Arizu-KeyYour app key
X-Arizu-TimestampCurrent Unix time in seconds. It must be within 5 minutes of the server clock.
X-Arizu-Nonce16 to 64 random characters from A-Z a-z 0-9 _ -, new for every request. A repeated nonce is refused.
X-Arizu-SignatureLowercase 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_BODY
  • METHOD is upper case, such as GET or POST.
  • PATH_AND_QUERY is 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_BODY is 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"}:

  • mode is the mode of your key: sandbox or production.
  • gateway says where the payments go: production, sandbox, simulator or unavailable.

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." }
  }
}
HTTPerror.codeMeaning
400invalid_jsonThe body is not a JSON object.
401invalid_key, key_revoked, bad_signature, stale_request, bad_nonce, replayedAuthentication failed. The message says which part. key_revoked means an admin revoked this key, so switch to the new one.
403app_disabled, ip_not_allowedThe app is turned off, or your IP is not on its allowlist.
404not_foundNo such payment for this app, or no such endpoint.
409order_existsThe order_id already exists with a different amount.
409not_pendingThe payment is no longer pending, so it cannot be cancelled.
413too_largeThe body is over 64 KB.
422invalid_requestValidation failed. fields says which fields.
429rate_limitedOver 240 requests a minute for this app in this mode. Wait for Retry-After seconds.
503payments_pausedArizu 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.
503gateway_unavailable, unavailablePayments are not available in this mode yet, or the service is busy. Retry later.
500server_errorUnexpected error, already logged on our side. Retry with backoff.

02.1Endpoints

Create a payment

POST/api/pay/v1/payments

FieldTypeRequiredNotes
order_idstringyesYour 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.
amountintegeryesWhole rupiah, from 10000 to 100000000. This is what the customer owes you, before any payment fee.
descriptionstringnoUp to 255 characters, shown on the checkout. Defaults to "Order {order_id}".
itemsarraynoUp to 50 items of { "name", "price", "quantity" }. price is whole rupiah and quantity is 1 to 1000. price × quantity summed must equal amount.
customerobjectno{ "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_urlstringnoWhere the customer goes after paying or giving up. It must be on one of your allowed return hosts. Defaults to your app website.
expires_inintegernoMinutes 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.
channelsarraynoLimit this payment to some method codes, such as ["BC","M2","NQ"]. See Payment methods.
metadataobjectnoYour 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 as pay_7k2m....
  • GET /payments?order_id=TOPUP-1001 looks a payment up by your own order_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

QueryNotes
statuspending, paid, expired or cancelled
limit1 to 100, default 20
starting_afterA payment id. Returns older payments, for paging.
created_from, created_toDates 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"
}
FieldNotes
modesandbox or production, the mode of the key that created the payment
amountWhat you asked for. Credit the customer for this.
feeThe payment fee the customer pays on top, for the chosen method. It is 0 when the merchant carries the fee.
totalamount + fee, what the customer is charged
channel, instructionsEmpty until the customer picks a method. instructions.type is va, qris, code (pay at a counter) or redirect (finish on the provider page).
checkout_urlThe hosted page. You can send the customer back to it at any time while the payment is pending.
flagUsually 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).
risknull 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.
StatusMeaning
pendingWaiting for the customer. They may change methods while it is pending.
paidThe money arrived and the gateway confirmed it. This is final.
expiredTime ran out before payment.
cancelledYou, 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}.

SignalPointsMeaning
automation40The browser says it is driven by automation.
headless35A headless browser or a software graphics renderer.
hosting_ip25The IP belongs to a data centre, hosting or VPN network.
shared_device20The same device paid with 3 or more different customer emails in 7 days.
timezone_mismatch15The device time zone does not fit the IP country.
ua_mismatch15The browser's user agent and its own platform data disagree.
busy_ip15More than 10 payments were opened from the IP in the last hour.
foreign_ip10The IP is outside Indonesia.
odd_browser10Browser details do not add up, such as no languages or a zero-size screen.
no_browser_data10The 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:

GroupCodes
Virtual accountBC 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
QRISNQ Nobu, SP ShopeePay, SQ Nusapay
E-walletDA DANA, OV OVO, SA ShopeePay, LA and LF LinkAja
RetailFT Alfamart, Pegadaian and Pos, IR Indomaret
OtherVC 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:

EventWhen
payment.pendingThe customer picked a method, so instructions are ready. Sent again each time they switch methods.
payment.paidThe payment is paid. Fulfil the order now.
payment.expiredTime ran out unpaid.
payment.cancelledThe payment was cancelled.
pingA 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 id to skip events you have already handled. Let the payment's status and 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=paid

These 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 0044 and Mastercard 5500 0000 0000 0004, valid until 03/33 with CVV 123.
  • Duitku then sends its callback, and your sandbox webhook receives payment.paid exactly 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:

  1. Create the new key and give it a label, such as "Live server".
  2. Put the new key and secret in your server config and deploy.
  3. 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:

  1. 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_SECRET and ARIZU_PAY_WEBHOOK_SECRET.
  2. When a player buys a package, create your own top-up row with status pending, a unique order id (for example TOPUP-<row id>) and the price from your own price list. Never take the price from the browser.
  3. Call POST /payments with that order id, amount, items, customer, return_url and metadata. Save payment.id on the row, then redirect the player to payment.checkout_url.
  4. Build the webhook endpoint as shown above. On payment.paid, lock the row, check the amount, add the balance once and set the row to paid. On payment.expired or payment.cancelled, set the row to failed only if it is still pending.
  5. Build the return page: read the payment from the API and show the result. Offer a "Pay now" button with checkout_url while it is still pending.
  6. Optional but recommended: every 10 minutes, ask GET /payments/{id} about rows that have been pending for more than 15 minutes, in case a webhook was missed.
  7. 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.
  8. 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 /ping should 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 metadata at 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.