Payout Notification

The global.payout.updated webhook that Durianpay sends when a payout changes.

Webhook: global.payout.updated

This is a server-to-server webhook that Durianpay sends to your system. For every payout status change, Durianpay sends an event to your URL with a POST request. You register the URL in the Durianpay dashboard, under Settings → Webhooks. The API has no endpoint to manage webhook URLs.


Webhook Specifications

  • Method: POST to the URL that you registered for this event
  • Content-Type: application/json
  • Headers: the SNAP headers of Durianpay's SNAP notifications, with an X-SIGNATURE from Durianpay
  • First delivery: Durianpay tries to send the event within five seconds after the status change.
  • Retries: when you do not answer with HTTP 200 or 201, Durianpay sends the event again. The time between two attempts is 2, 5, 10, 90 and then 210 minutes. After the last retry, Durianpay stops the delivery of that event.
  • Configuration: sandbox and production have separate dashboards and separate URLs
📘

Use one URL for each event

The event body has no field that identifies the event. Register a different URL for each event, so that the URL tells you which event arrived.


Subscribed Event

Event NameWhen Durianpay sends it
global.payout.updatedEvery payout status change.
  • Durianpay sends the event even when your own call made the change, for example a cancel.
  • When you create a payout, Durianpay sends no event. The response of Create Payout API gives the first status, processing.
  • While a payout waits for screening or review, it stays processing, and Durianpay sends no event. The payout object does not show the screening or the review.

Request Headers

POST /hooks/durianpay/payouts
Content-Type: application/json
X-TIMESTAMP: 2026-06-10T10:41:07+07:00
X-PARTNER-ID: <your client key>
X-EXTERNAL-ID: <unique ID of this delivery attempt>
CHANNEL-ID: 00001
X-SIGNATURE: <base64 SHA256withRSA signature>
HeaderDescription
X-TIMESTAMPThe time of sending, RFC 3339 with an offset. Use the text exactly as you receive it.
X-PARTNER-IDYour SNAP client key.
X-EXTERNAL-IDThe ID of this delivery attempt. A retry has a new value, so you cannot use this header to find a repeated event.
CHANNEL-IDAlways 00001.
X-SIGNATUREThe Durianpay signature: SHA256withRSA (RSASSA-PKCS1-v1_5 with SHA-256) with the Durianpay private key, in standard base64.

Field Definition

The event body is the JSON request body that Durianpay sends to your URL. It has the same format as the Durianpay SNAP transfer notification.

FieldTypeDescription
originalReferenceNostringThe payout referenceNo.
originalPartnerReferenceNostringYour partnerReferenceNo of the payout. It is not in the event body when the payout has no partnerReferenceNo. An example is a payout that was created in the Durianpay dashboard without a reference.
responseCodestringAlways 2000000. It does not give the status.
responseMessagestringAlways Request has been processed successfully.
amountobjectThe amount that the beneficiary gets: the destination of the payout, as {value, currency}.
beneficiaryAccountNostringThe account identifier of the payment account.
beneficiaryBankCodestringThe bankCode of the payment account. It is not in the event body when the payment account has no bankCode.
sourceAccountNostringYour Durianpay merchant ID.
additionalInfo.statusstringThe new status of the payout.
additionalInfo.actionstringOnly for need_action. Coming soon.
additionalInfo.refundAmountobjectOnly for refunded. The money that came back to your balance: the full totalDebit of the payout, fee included, as {value, currency} in IDR.

Webhook Payload Example

{
  "originalReferenceNo": "orm_2m9x4h",
  "originalPartnerReferenceNo": "merchant-tx-44821",
  "responseCode": "2000000",
  "responseMessage": "Request has been processed successfully",
  "amount": {
    "value": "9876.54",
    "currency": "USD"
  },
  "beneficiaryAccountNo": "******1847",
  "beneficiaryBankCode": "026009593",
  "sourceAccountNo": "mer_8a7c2d",
  "additionalInfo": {
    "status": "completed"
  }
}
{
  "originalReferenceNo": "orm_6cx3wn",
  "originalPartnerReferenceNo": "merchant-tx-44860",
  "responseCode": "2000000",
  "responseMessage": "Request has been processed successfully",
  "amount": {
    "value": "9876.54",
    "currency": "USD"
  },
  "beneficiaryAccountNo": "******1847",
  "beneficiaryBankCode": "026009593",
  "sourceAccountNo": "mer_8a7c2d",
  "additionalInfo": {
    "status": "failed"
  }
}
{
  "originalReferenceNo": "orm_2m9x4h",
  "originalPartnerReferenceNo": "merchant-tx-44821",
  "responseCode": "2000000",
  "responseMessage": "Request has been processed successfully",
  "amount": {
    "value": "9876.54",
    "currency": "USD"
  },
  "beneficiaryAccountNo": "******1847",
  "beneficiaryBankCode": "026009593",
  "sourceAccountNo": "mer_8a7c2d",
  "additionalInfo": {
    "status": "refunded",
    "refundAmount": {
      "value": "160015000.00",
      "currency": "IDR"
    }
  }
}

The examples show a completed payout, a payout that you cancelled, and a paid payout whose funds came back.


📘 Status Handling

An event gives only the new status. For the details, call the Fetch Payout by ID API.

additionalInfo.statusadditionalInfo.actionWhat to do
need_actionComing soonThis feature is coming soon.
processing—Wait for the outcome.
completed—The beneficiary is paid. Reconcile settlement and get the receipt.
failed—To get the failure code, call the Fetch Payout by ID API. For a cancel (coming soon), the code is CANCELLED. See Response Code Handling.
refunded—The funds came back. Check additionalInfo.refundAmount and your balance.

Status Definition gives the meaning of each status.


🔐 Digital Signature Verification

Durianpay signs every webhook. Verify the signature before you process the event.

X-SIGNATURE signs a string of four parts, joined with ::

POST:<path>:<lowercase hex SHA-256 of the minified JSON body>:<X-TIMESTAMP>
  • Path: the path of your registered URL, such as /hooks/durianpay/payouts, without the host and the query string.
  • Event body: remove the whitespace outside the JSON values (the whitespace that is not inside a string), then hash the result. Do not parse the JSON and encode it again: this can change escapes and numbers.
  • Key: verify with the Durianpay public key. Download it in the Durianpay dashboard, under Settings → API Key. Sandbox and production have different keys.

Verification example

Each example takes the raw event body, the path of your URL, the X-TIMESTAMP and X-SIGNATURE headers, and the Durianpay public key in PEM format:

  • Python: pass the event body as bytes. The example uses the cryptography package.
  • Node.js: pass the raw event body as a Buffer, before any JSON parsing. The example uses the built-in crypto module.
  • Go: the example uses the standard library only.
import base64
import hashlib

from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding

def minify(raw_body):
    out = bytearray()
    in_string = escaped = False
    for byte in raw_body:
        if in_string:
            out.append(byte)
            if escaped:
                escaped = False
            elif byte == ord("\\"):
                escaped = True
            elif byte == ord('"'):
                in_string = False
        elif byte == ord('"'):
            in_string = True
            out.append(byte)
        elif byte not in b" \t\r\n":
            out.append(byte)
    return bytes(out)

def verify_webhook(raw_body, path, timestamp, signature, public_key_pem):
    body_hash = hashlib.sha256(minify(raw_body)).hexdigest()
    message = f"POST:{path}:{body_hash}:{timestamp}".encode("utf-8")
    public_key = serialization.load_pem_public_key(public_key_pem)
    try:
        public_key.verify(base64.b64decode(signature, validate=True), message, padding.PKCS1v15(), hashes.SHA256())
    except (InvalidSignature, ValueError):
        return False
    return True
const crypto = require("crypto");

function minify(rawBody) {
  const out = [];
  let inString = false;
  let escaped = false;
  for (const byte of rawBody) {
    if (inString) {
      out.push(byte);
      if (escaped) {
        escaped = false;
      } else if (byte === 0x5c) {
        escaped = true;
      } else if (byte === 0x22) {
        inString = false;
      }
    } else if (byte === 0x22) {
      inString = true;
      out.push(byte);
    } else if (![0x20, 0x09, 0x0d, 0x0a].includes(byte)) {
      out.push(byte);
    }
  }
  return Buffer.from(out);
}

function verifyWebhook(rawBody, path, timestamp, signature, publicKeyPem) {
  const bodyHash = crypto.createHash("sha256").update(minify(rawBody)).digest("hex");
  const message = Buffer.from(`POST:${path}:${bodyHash}:${timestamp}`, "utf8");
  try {
    return crypto.verify("sha256", message, publicKeyPem, Buffer.from(signature, "base64"));
  } catch (err) {
    return false;
  }
}
package snap

import (
	"crypto"
	"crypto/rsa"
	"crypto/sha256"
	"crypto/x509"
	"encoding/base64"
	"encoding/hex"
	"encoding/pem"
)

func minify(raw []byte) []byte {
	out := make([]byte, 0, len(raw))
	inString, escaped := false, false
	for _, b := range raw {
		switch {
		case inString:
			out = append(out, b)
			if escaped {
				escaped = false
			} else if b == '\\' {
				escaped = true
			} else if b == '"' {
				inString = false
			}
		case b == '"':
			inString = true
			out = append(out, b)
		case b != ' ' && b != '\t' && b != '\r' && b != '\n':
			out = append(out, b)
		}
	}
	return out
}

func VerifyWebhook(rawBody []byte, path, timestamp, signature string, publicKeyPEM []byte) bool {
	block, _ := pem.Decode(publicKeyPEM)
	if block == nil {
		return false
	}
	key, err := x509.ParsePKIXPublicKey(block.Bytes)
	if err != nil {
		return false
	}
	rsaKey, ok := key.(*rsa.PublicKey)
	if !ok {
		return false
	}
	sig, err := base64.StdEncoding.DecodeString(signature)
	if err != nil {
		return false
	}
	bodySum := sha256.Sum256(minify(rawBody))
	message := "POST:" + path + ":" + hex.EncodeToString(bodySum[:]) + ":" + timestamp
	digest := sha256.Sum256([]byte(message))
	return rsa.VerifyPKCS1v15(rsaKey, crypto.SHA256, digest[:], sig) == nil
}

Signature test vector

Check your verifier with this synthetic input. The same input also checks the Node.js and Go examples. The key pair is for this example only: it is not the Durianpay key. The event body is one line with no trailing newline.

test_public_key = b"""-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3thE5s4JeaN17nNdUU3C
6OsvscvQ9Oib/d3xhSQnBvW0UcUFa+N/JyNJhxRYgl1o1GaDC84Hoeoes/PfFwH0
yEhlRqc+uXLRROLPjp7r88+oG/0bq+6aom+dKpFfoXXlzJ28t4SqMudwIcVAbINP
dLsr+zn1JC00EefbhkRGD490gLIWT3z7rJspOsCQB/AtEy3EnFFllnssozP2ouw5
UDMIzEsUsirPENoNPomYA55tmj2mQpGW4IziF6s4+6SOEKzOqUgTG+xeuxILcVWF
vz7rv5HRBlMItX8lgkeAJzOpk7NqOhniOjsv60WZ7+ijZ5QNJNHgU1wndG8gcKmi
hwIDAQAB
-----END PUBLIC KEY-----
"""
test_body = b'{"originalReferenceNo":"orm_test","originalPartnerReferenceNo":"test-001","responseCode":"2000000","responseMessage":"Request has been processed successfully","amount":{"value":"100.00","currency":"USD"},"beneficiaryAccountNo":"******1234","beneficiaryBankCode":"026009593","sourceAccountNo":"mer_test","additionalInfo":{"status":"completed"}}'
test_timestamp = "2026-06-10T10:41:07+07:00"
test_signature = "b6siU3CobaX7KUQzymyKqtDJeUReOU2vvXCs7Dhgn9X9XDoNBG7F1mvTZCUMPP82XxDE7Yc22iczFrL64EnwSk/QoaYWHGlq8QhvvtzFCNnnSTsBQ5Ah01I1clfWqRwOZIx3LzCB6NxmxeN0oB/9FrXXadZOnXcGUJQ+o8HSA9rgVZpSk2Fdb/Qz+UnnQycBoXt+YTDwzBJN+zgLl9q9I9UztaT74cNSXUJOWmyT13qhiwVMfZTXWc/LG83fu/wUTqR1/oYc/p6g4HqIP9IkODx+kCnm1HH3qBkXLTDY/YldJULaie62IoLVcAckrd3GZNqRim8i5Vm04zYse0T08g=="

assert verify_webhook(test_body, "/hooks/durianpay/payouts", test_timestamp, test_signature, test_public_key)
assert not verify_webhook(test_body, "/other-path", test_timestamp, test_signature, test_public_key)
assert not verify_webhook(test_body.replace(b"completed", b"failed"), "/hooks/durianpay/payouts", test_timestamp, test_signature, test_public_key)

✅ How to Answer

  1. Verify X-SIGNATURE. If the signature is not valid, do not process the event, and return HTTP 401.
  2. Store or queue the event, and return HTTP 200 within 10 seconds. Durianpay retries after any response other than HTTP 200 or 201, and after a timeout.
  3. Find the payout by originalReferenceNo. Compare additionalInfo.status with the status that you have, and use the rules below.

The event body has no event ID and no event time. Build your handler for these cases:

  • Repeats: the same event can arrive again, even with a valid signature. A repeated event gives the status that you already have.
  • Same status again: an event with the status that you already have can also come from a new change. The event does not show the difference. So when an event gives the status that you already have, call the Fetch Payout by ID API.
  • Different status: the event can be old, because events can arrive in any order. Read the payout with the Fetch Payout by ID API, and store the status in the response. Do not store the status in the event. For a payout, failed and refunded do not change again, and completed can change only to refunded. So if your payout is failed or refunded, an event with another status is an old event.
  • Before you act on a status: first call the Fetch Payout by ID API, and act on the status that it returns.
sequenceDiagram
    autonumber
    participant M as Merchant server
    participant API as Global Payout API
    participant WH as Merchant webhook endpoint
    Note over M: Register one URL for each event in the Durianpay dashboard
    API->>WH: POST event with SNAP headers and X-SIGNATURE
    Note over WH: Verify X-SIGNATURE with the Durianpay public key
    Note over WH: Store or queue the event
    WH-->>API: HTTP 200 within 10 seconds
    opt Other response or timeout
        API->>WH: Retry after 2 min, 5 min, 10 min, 90 min, then 210 min
    end
    opt Same status as before, or you missed events
        M->>API: GET the payout, beneficiary or customer
        API-->>M: 200 current state
    end

Missed events

When you miss events, call the Fetch Payout by ID API or the Fetch Payouts API to get the current status of each payout. See also Handling Webhooks.