Beneficiary Notification

The global.beneficiary.updated webhook that Durianpay sends when a beneficiary changes status.

Webhook: global.beneficiary.updated

This is a server-to-server webhook that Durianpay sends to your system. For every beneficiary 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.beneficiary.updatedEvery beneficiary status change, even when the response to the create request already shows active.

Durianpay sends the event even when your own call made the change, for example when you deactivate the beneficiary with Deactivate Beneficiary API.


Request Headers

Durianpay sends the same SNAP headers as for Payout Notification:

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

FieldTypeDescription
originalReferenceNostringThe beneficiary referenceNo.
originalPartnerReferenceNostringYour partnerReferenceNo of the beneficiary.
responseCodestringAlways 2000000. It does not give the status.
responseMessagestringAlways Request has been processed successfully.
additionalInfo.statusstringThe new status of the beneficiary.

A beneficiary event has no amount, beneficiaryAccountNo, beneficiaryBankCode or sourceAccountNo. Only payout events have these fields.


Webhook Payload Example

A beneficiary passed screening:

{
  "originalReferenceNo": "par_7pq3m",
  "originalPartnerReferenceNo": "bnf-acme-001",
  "responseCode": "2000000",
  "responseMessage": "Request has been processed successfully",
  "additionalInfo": {
    "status": "active"
  }
}

📘 Status Handling

additionalInfo.statusMeaningWhat to do
processingDurianpay screens or reviews the beneficiary. This occurs after you create the beneficiary, or after you change a field that Durianpay screens.Wait for the next event, or call the Fetch Beneficiary by ID API.
activeThe beneficiary can receive new payouts.Send the referenceNo of one of its payment accounts when you create a payout.
rejectedScreening rejected the beneficiary.Do not use it.
inactiveYou deactivate the beneficiary.Do not use it for new payouts.

An event gives only the new status. For the details, call the Fetch Beneficiary by ID API. Beneficiary Object explains the lifecycle.


🔐 Digital Signature Verification

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, 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.

Payout Notification has verification examples in Python, Node.js and Go, and a test vector.


✅ 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 beneficiary 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:

  • 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 Beneficiary by ID API.
  • Different status: events can arrive in any order, so the event can be older than the status that you have. Call the Fetch Beneficiary by ID API, and store the status that it returns.
  • Before you act on a status: first call the Fetch Beneficiary by ID API, and act on the status that it returns.

Missed events

When you miss events, call the Fetch Beneficiary by ID API to get the current status of each beneficiary. See also Handling Webhooks.