Override Notification URL


Merchant can opt to edit or add custom notification URLs on every transaction. It can be achieved by attaching additional HTTP headers to the charge request. This is only applies for Transaction notification.

Midtrans provides two headers given below.


  1. X-Append-Notification: to add new notification URL(s) alongside the settings on dashboard.
curl -X POST \
  https://api.midtrans.com/v2/charge \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic NjJiMTVhN2QtZTVmOC00YjNjLTllYWItY2E4MjdjYTM3ZjU1Og==' \
  -H 'Content-Type: application/json' \
  -H 'X-Override-Notification: https://example.com/test1,https://example.com/test2' \
  -H 'cache-control: no-cache' \
  -d '{
    "payment_type": "gopay",
    "transaction_details": {
        "order_id": "1553229166",
        "gross_amount": 10000
    }
}'
  1. X-Override-Notification: to use new notification URL(s) disregarding the settings on dashboard.

Both the headers can receive up to a maximum of three URLs.


Let us assume that you have set https://example.com as your notification URL on the dashboard.

If you set X-Append-Notification with values https://example.com/test1,https://example.com/test2, then every HTTP notification for that specific transaction is sent to the URLs given below.

  1. https://example.com,
  2. https://example.com/test1, and
  3. https://example.com/test2

If you set X-Override-Notification with values https://example.com/test1,https://example.com/test2, then every HTTP notification for that specific transaction is sent to the URLs given below.

  1. https://example.com/test1 and
  2. https://example.com/test2

📘

Note

When both X-Append-Notification and X-Override-Notification are used together, then only override will be used.


Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!