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.
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
}
}'
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.
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.
Note
When both
X-Append-Notification
andX-Override-Notification
are used together, then only override will be used.