Skip to main content

Webhooks

When an order or disbursement status changes, the API sends an HTTP POST to its notify_url. Order and disbursement callbacks use different signature schemes; verify the signature before processing either callback type.

If your webhook endpoint is protected by a firewall or WAF, whitelist every address on the Network Allowlisting page before live testing.

Setting Your Notify URL​

You can specify notify_url on each order or disbursement creation request. If omitted, the system uses the default URL configured on your merchant profile. Ask your administrator to confirm that URL before live testing.

Order Callback Payload​

{
"event": "order.PAID",
"ref_code": "ORD-260601103045-A1B2",
"merchant_order_id": "your-internal-order-id",
"amount": 50000,
"status": "PAID",
"paid_at": "2026-06-01T10:30:45Z"
}

Fields​

FieldTypeDescription
eventstringorder.<STATUS> — e.g., order.PAID, order.FAILED, order.EXPIRED
ref_codestringFlyPay order reference
merchant_order_idstringYour original order ID
amountnumberOrder amount in Rupiah
statusstringNew order status
paid_atstring (ISO 8601)Timestamp of payment; null if not yet paid

Status Values​

StatusMeaning
PENDINGAwaiting payment
PAIDPayment confirmed
EXPIREDOrder expired before payment
FAILEDPayment failed or was rejected
CANCELLEDOrder was cancelled
REFUNDEDFully refunded
PARTIALLY_REFUNDEDPartially refunded

Disbursement Callback Payload​

Bank and e-wallet disbursement callbacks use this payload shape:

{
"clientId": "your-callback-client-id",
"refCode": "DSB-260601110000-C3D4",
"orderId": "disb-20260601-001",
"accountNumber": "1234567890",
"accountName": "Budi Santoso",
"bank": {
"name": "Bank Central Asia",
"code": "014"
},
"method": "BANK_ACCOUNT",
"requestAmount": "500000.00",
"disbursementFee": "1800.00",
"disbursementAmount": "501800.00",
"status": "SUCCESS",
"requestAt": "2026-06-01 18:00:00"
}

orderId is the idempotency key supplied when the disbursement was created. disbursementAmount is the total wallet debit: requestAmount + disbursementFee. E-wallet callbacks use method: "EWALLET", and the bank object identifies the e-wallet provider.

Possible disbursement callback statuses include PENDING, IN_REVIEW, ON_PROCESS, PENDING_GET_STATUS_VENDOR, SUCCESS, FAILED, and REJECTED.

Responding to Webhooks​

Your endpoint must return any HTTP 2xx response within 10 seconds. Non-2xx responses and timeouts trigger a retry.

tip

Immediately return 200 OK and process the event asynchronously. Do not block the response on database writes or downstream API calls.

PHP — minimal webhook handler
<?php
// Acknowledge immediately
http_response_code(200);
echo json_encode(['received' => true]);

// Close the connection so PHP can continue processing
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
}

// Now process safely
$payload = json_decode(file_get_contents('php://input'), true);
if ($payload['status'] === 'PAID') {
// update your order in DB
}

Verify Callback Signatures​

The X-Signature header name is case-insensitive. Its value and verification algorithm depend on the callback type:

CallbackSignature valueVerification material
Order statussha256=<lowercase-hex-HMAC>Your Webhook Secret
Bank or e-wallet disbursement statusBase64-encoded RSA signatureYour callback client credentials and the platform callback public key

Order callbacks: HMAC-SHA256​

A Webhook Secret must be provisioned for your merchant. The platform signs the exact raw HTTP request body with HMAC-SHA256 and sends:

An administrator acquires it in the dashboard:

  1. Open Merchants, then select the merchant.
  2. In Merchant Details, find Order Callback Signing.
  3. Select Rotate Webhook Secret.
  4. Securely copy the one-time value to the merchant's server configuration.

The Webhook Secret is also returned once when a merchant is initially created. Rotating it invalidates the previous value immediately, so coordinate the server update before rotating an active integration.

X-Signature: sha256=<lowercase-hex-HMAC>

Do not parse and re-encode the JSON before verification. Even an insignificant whitespace change produces a different signature. If the header is absent or invalid, return HTTP 401 without changing order state.

PHP — signature verification
$rawBody = file_get_contents('php://input');
$receivedSig = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
$expectedSig = 'sha256=' . hash_hmac('sha256', $rawBody, $webhookSecret);

if (!hash_equals($expectedSig, $receivedSig)) {
http_response_code(401);
exit('Invalid signature');
}
Node.js — signature verification
const crypto = require('crypto');

function verifySignature(rawBody, receivedSig, secret) {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(rawBody)
.digest('hex');
const actual = Buffer.from(receivedSig);
const wanted = Buffer.from(expected);
return actual.length === wanted.length && crypto.timingSafeEqual(actual, wanted);
}
caution

Always use a constant-time comparison function (hash_equals in PHP, timingSafeEqual in Node.js) to prevent timing attacks.

Disbursement callbacks: RSA-SHA256​

Disbursement callbacks use RSA PKCS#1 v1.5 with SHA-256. This is a separate contract from the order callback HMAC. You need a Callback Client ID and Callback Client Secret. These are not your API key or Webhook Secret.

Acquire callback credentials​

A platform or aggregator administrator provisions these credentials in the dashboard:

  1. Open Merchants, then select the merchant.
  2. In Merchant Details, find Disbursement Callback Signing.
  3. Select Generate Callback Credentials.
  4. Securely copy both values to the merchant's server configuration.

The Callback Client Secret is displayed only once. Store it in a secrets manager; do not put it in frontend code, source control, logs, or support messages. If it is lost or exposed, an administrator must select Rotate Callback Secret and update the merchant server before another callback is delivered. Rotation takes effect immediately.

Some migrated merchants may temporarily show Legacy fallback. Their existing legacy credential pair will continue to validate callbacks until dedicated callback credentials are generated. Once generated, the dedicated credentials take precedence.

Download and pin the platform disbursement callback public key. Its SHA-256 fingerprint over the DER-encoded key is:

16772b9aee0f0fbd5bf8ba67485119372fd3966606683faa7bb1fbe1c947a407

You can verify the downloaded key before installing it:

curl -fsS https://docs.flypay.asia/keys/disbursement-callback-public.pem \
| openssl pkey -pubin -outform DER \
| openssl dgst -sha256

The platform constructs the signature as follows:

bodyHash     = lowercase_hex(SHA256(exact_raw_request_body))
stringToSign = callbackClientId + "|" + callbackClientSecret + "|" + bodyHash
X-SIGNATURE = base64(RSA_PKCS1_V1_5_SHA256(stringToSign))

Hash the exact raw bytes received by your endpoint. Do not hash parsed or reformatted JSON. Also confirm that the payload's clientId exactly matches the Callback Client ID provisioned for your merchant.

PHP — disbursement signature verification
$rawBody = file_get_contents('php://input');
$receivedSignature = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
$payload = json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR);

if (!isset($payload['clientId']) ||
!hash_equals($callbackClientId, (string) $payload['clientId'])) {
http_response_code(401);
exit('Invalid client ID');
}

$signatureBytes = base64_decode($receivedSignature, true);
$publicKey = openssl_pkey_get_public(
file_get_contents('/secure/path/disbursement-callback-public.pem')
);
$bodyHash = hash('sha256', $rawBody);
$stringToSign = $callbackClientId.'|'.$callbackClientSecret.'|'.$bodyHash;

$valid = $signatureBytes !== false && $publicKey !== false &&
openssl_verify(
$stringToSign,
$signatureBytes,
$publicKey,
OPENSSL_ALGO_SHA256
) === 1;

if (!$valid) {
http_response_code(401);
exit('Invalid signature');
}
Node.js — disbursement signature verification
const crypto = require('crypto');

function verifyDisbursementSignature(
rawBody,
receivedSignature,
callbackClientId,
callbackClientSecret,
publicKeyPem,
) {
const payload = JSON.parse(rawBody.toString('utf8'));
if (payload.clientId !== callbackClientId) return false;

const bodyHash = crypto.createHash('sha256').update(rawBody).digest('hex');
const stringToSign = `${callbackClientId}|${callbackClientSecret}|${bodyHash}`;

return crypto.verify(
'RSA-SHA256',
Buffer.from(stringToSign, 'utf8'),
{key: publicKeyPem, padding: crypto.constants.RSA_PKCS1_PADDING},
Buffer.from(receivedSignature, 'base64'),
);
}

Reject a disbursement callback if its signature is missing or invalid. Ask your platform or aggregator administrator to provision the credentials if Disbursement Callback Signing shows Not configured. Keep the client secret server-side and never include it in logs or responses.

Retry Schedule​

If your endpoint does not return HTTP 2xx, delivery is retried on this schedule:

AttemptDelay after previous
1 (initial)Immediate
2+30 seconds
3+2 minutes
4+10 minutes
5+30 minutes
6 (final)+2 hours

After the final attempt, the webhook is marked as permanently failed. You can still poll the order status via GET /v1/orders/:ref_code.

Idempotency​

Your system may receive the same callback more than once because of network failures or retries. For orders, deduplicate using ref_code or merchant_order_id. For disbursements, use refCode together with status. Signature verification does not replace idempotency checks.