Webhooks and callbacks


Whenever certain transaction actions occur on your Durianpay Checkout integration, we trigger events which your application can listen to. This is where webhooks come in. A webhook is a URL on your server where we send payloads for such events. For example, if you implement webhooks, once a payment is successful, we will immediately notify your server with a payment.completed event. Here is a list of events we can send to your webhook URL.

You can specify your webhook URL on your dashboard (or through your dedicated Customer success manager) where we would send POST requests to whenever an event occurs.

Valid events

payment.completed, payment.failed, payment.cancelled, order.created, order.completed, subscription.created, subscription.updated, subscription.notification_sent

Webhook events explained

NameDescription
payment.completedThis event is triggered when a payment is successfully completed by the customer. Only when payment is completed on our end, we fire this event so you can safely use it to mark transaction/order completed on your side
payment.failedThis event is triggered when a payment is failed due to either timeout OR some other error.
payment.cancelledThis event is triggered when a payment is cancelled by the end user/customer for some reason
order.createdThis event is triggered when a order is successfully created on our end
order.completedThis event is triggered when a order is successfully paid for (Fully) on our end which means that one or more payments against the order has been successfully made and total amount of order has been captured
subscription.createdThis event is triggered when a subscription is successfully created on our end which means that first payment can be made
subscription.updatedThis event is triggered when a subscription payment is successfully paid or subscription is cancelled
subscription.notification_sentThis event is triggered when a subscription related notification is successfully sent to the customer by Durianpay

If you want to implement one, we recommend order.completed webhook event as it covers the scenario when users might pay using multiple payments for a single order

Setting up Webhooks

  • Create Webhooks in Settings > Create New

    Durian webhook 1
  • Fill up the event you want to subscribe to, give a name to webhook event and add your url which you want us to call

    Durian webhook 2

Sample webhook payloads

payment.completed
{  
  "event": "payment.completed",
  "data":{  
    "id": "pay_dAS123ad123Asd",
    "signature": "9e892f199d026d06a56669e658a56f264610431d24e8b4d07f7bd46f6d5062d2",
    "order_id": "ord_XXXXXXXXX",
    "amount": "10000",
    "currency": IDR,
    "paid_at": "2016-09-30T21:10:19.000Z",
    "created_at":"2016-09-30T21:09:56.000Z",
    "metadata": {
      "key": "value"
    },
}