Customer Notification

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

Webhook: global.customer.updated

This is a server-to-server webhook that Durianpay sends to your system. For every customer 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.

Customers exist only in a setup with customers. See Customers.


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.customer.updatedEvery customer status change.

Durianpay sends the event even when your own call made the change, for example when you deactivate the customer with Deactivate Customer 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 customer referenceNo.
originalPartnerReferenceNostringYour partnerReferenceNo of the customer.
responseCodestringAlways 2000000. It does not give the status.
responseMessagestringAlways Request has been processed successfully.
additionalInfo.statusstringThe new status of the customer.

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


Webhook Payload Example

A customer was rejected:

{
  "originalReferenceNo": "cus_1abc9k",
  "originalPartnerReferenceNo": "cust-90871",
  "responseCode": "2000000",
  "responseMessage": "Request has been processed successfully",
  "additionalInfo": {
    "status": "rejected"
  }
}

📘 Status Handling

additionalInfo.statusMeaningWhat to do
processingDurianpay screens or reviews the customer. This occurs after you create the customer, or after you change the name, identity-document number, birth date or nationality.Wait for the next event, or call the Fetch Customer by ID API.
activeYou can use the customer for new payouts.Send its referenceNo when you create a payout.
rejectedThe rejection is final.You cannot update the customer or use it for new payouts.
inactiveYou deactivate the customer.You cannot update the customer or use it for new payouts.

An event gives only the new status. For the details, call the Fetch Customer by ID API. Customer 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 customer 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 Customer 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 Customer by ID API, and store the status that it returns.
  • Before you act on a status: first call the Fetch Customer by ID API, and act on the status that it returns.

Missed events

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