Webhooks

The Webhook API allows your server to receive asynchronous event notifications from the platform, such as when a transaction status change occurs, the gateway sends a webhook notification to merchants to inform them about the change.

When an event occurs, the platform will make a HTTP POST request to the Webhook destination URL, sending data about the event in the POST request body.

Request Format

Webhooks are HTTP POST requests that the platform sends to the destination URL. Data is formatted as application/json. The POST parameters for each event are described in the sections below.

Response Format

The Webhook URL should return a response with HTTP status code 200. Any other HTTP response code will be treated as a failure. It is not necessary for Webhook response to return any content.

In case of a failure the platform will resend the notification 4 times.

Configure webhooks

To configure the Webhook destination URLs, please, follow the steps:

  • Log in to your Merchant portal.
  • Go to Developer settings > Website settings > Webhook default URLs.
  • Select the website.
  • Set the Webhook destination URLs for sandbox and live modes.

Webhook signature

Signature is used in webhooks and protects the message from changes. Each webhook is signed by the signature, signature of webhook is sent in webhooks HTTP header.

Signature is calculated by the gateway from API key value and JSON body of webhook with SHA-512.

For example, Merchant has following parameters:

API key: live_493gfg37gf97g34f7g Received webhook’s JSON body Then Merchant will need to calculate SHA-512 signature of the following string:

{“Id”: “evn_78BAWY72SO”, “Type”: “authAuthorised”, …}live_493gfg37gf97g34f7g

That will result in the following:
1b0c01c5815c0b9e8d28d92cbb4b23bf31cc4949b75379c5d36130
7a165bdc0d44e8415345efd9a345255165d12791817067726d8e483156ec48f16803a48d5e09


The result string must be equal to string in the header Signature of webhook.

Handle duplicate events

Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you’ve processed, and then not processing already-logged events.

Order of events

The delivery of events in the order in which they are generated is not guaranteed.

The webhook endpoint should not expect delivery of these events in this order and should handle this accordingly. You can also use the API to fetch any missing objects.

Webhook parameters

Parameter

Description

Id

The Id of the event starting with “evn_ …”

Mode

Test or Live Mode

Type

The type of webhook consisting of the transaction type and the status

Id (in Data)

The unique transaction identifier

Status (in Data) 

The status of the transaction

Amount (in Data) 

Transaction amount of the action

Remaining Amount (in Data) 

The amount remaining from the original transaction when executing partial refunds

Currency (in Data) 

Currency

Reference (in Data) 

The reference of the transaction which the user previously enters in the request body

Created (in Data) 

The creation date and time of the action

Decline Code (in Data) 

The decline code related to the decline message

Decline Code (in Data) 

The decline message

Created 

The creation date and time of the event

Auth webhooks

Webhooks sent for the Auth transaction type.

The received amount validation

For the following payment methods: PayTM, UPI, IMPS, GPAY, PHONEPE the requested amount and the amount received in webhook notifications is not always the same. The requested amount must be validated to be equal to the amount received in webhook notifications. The amount received in webhook notifications is the valid one.

AuthAuthorised

{
“Id”: “evn_78BAWY72SO”,
“Type”: “authAuthorised”,
“Data”: {
“Id”: “aut_VL82N3ZHD1”,
“Status”: “Authorised”,
“Amount”: 10.55,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2020-11-25T10:05:28.407905”
},
“Created”: “2020-11-25T10:05:55.551186Z”
}

AuthDeclined

{
“Id”: “evn_78BAWY72SO”,
“Type”: “authDeclined”,
“Data”: {
“Id”: “aut_VL82N3ZHD1”,
“Status”: “Declined”,
“Amount”: “10.55”,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“DeclineCode”: “DeclinedByThreeDSecure”,
“DeclineMessage”: “Declined by 3D Secure.”,
“Created”: “2020-11-25T10:05:28.407905”
},
“Created”: “2020-11-25T10:05:55.551186Z”
}

AuthCaptured

{
“Id”: “evn_78BAWY72SO”,
“Type”: “authCaptured”,
“Data”: {
“Id”: “aut_VL82N3ZHD1”,
“Status”: “Captured”,
“Amount”: “10.55”,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2020-11-25T10:05:28.407905”
},
“Created”: “2020-11-25T10:05:55.551186Z”
}

AuthVoided

{
“Id”: “evn_78BAWY72SO”,
“Type”: “authVoided”,
“Data”: {
“Id”: “aut_VL82N3ZHD1”,
“Status”: “Voided”,
“Amount”: “10.55”,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2020-11-25T10:05:28.407905”
},
“Created”: “2020-11-25T10:05:55.551186Z”
}

Purchase webhooks

Webhooks sent for the Purchase transaction type.

PurchaseDeclined

{
“id”: “evn_123yoff418”,
“mode”: “Live”,
“type”: “purchaseDeclined”,
“data”: {
“id”: “trn_udmgw5782d”,
“status”: “Declined”,
“paymentMethod”: “VISA”,
“amount”: “100.00”,
“currency”: “EUR”,
“reference”: “XXXXXXXXXXXX”,
“declineCode”: “declinedByAcquirer”,
“declineMessage”: “Declined by acquirer.”,
“created”: “2022-07-20T23:07:59.810009”
},
“created”: “2022-07-20T23:08:21.0746926Z”
}

PurchaseCaptured

{
“id”: “evn_xk3urds1hb”,
“mode”: “Live”,
“type”: “purchaseCaptured”,
“data”: {
“id”: “trn_gafi11pbiu”,
“status”: “Captured”,
“paymentMethod”: “VISA”,
“amount”: “8.99”,
“currency”: “EUR”,
“reference”: “XXXXXXXXXXXXXXXXXXX”,
“created”: “2022-07-21T05:12:05.819338”
},
“created”: “2022-07-21T05:12:22.4692086Z”
}

PurchasePartialyRefunded

see API References > Refunds for more information on how to create a Partial Refund

{
“Id”: “evn_j23ja9275i”,
“Mode”: “Test”,
“Type”: “purchasePartialyRefunded”,
“Data”: {
“Id”: “trn_hqg6xgnq3c”,
“Status”: “PartiallyRefunded”,
“Amount”: “3.5”,
“RemainingAmount”: 2.5,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2021-01-06T17:34:24.994751”
},
“Created”: “2021-01-06T17:34:30.8503693Z”
}

PurchaseRefunded

see API References > Refunds for more information on how to create a Refund

{
“Id”: “evn_j23ja9275i”,
“Mode”: “Test”,
“Type”: “purchaseRefunded”,
“Data”: {
“Id”: “trn_hqg6xgnq3c”,
“Status”: “Refunded”,
“Amount”: “3.5”,
“RemainingAmount”: 0,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2021-01-06T17:34:24.994751”
},
“Created”: “2021-01-06T17:34:30.8503693Z”
}

PurchaseReversed

To simulate a Purchase Reversed, use the following POST request:

POST https://api.quaife.net/v1/transactions/{{transactionId}}/reversals

{
“Id”: “evn_hbfeixnxwa”,
“Mode”: “Test”,
“Type”: “purchaseReversed”,
“Data”: {
“Id”: “trn_a58528qofa”,
“Status”: “Reversed”,
“Amount”: “3.5”,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2021-01-06T17:37:17.748094”
},
“Created”: “2021-01-06T17:37:22.6665207Z”
}

Capture webhooks

To simulate a Capture transaction, the original transaction has to be an “Auth” transaction which has to be Captured in our system, as shown below:

At this stage, changes to the Capture type transactions will result in the following webhooks:

CaptureDeclined

{
“Id”: “evn_78BAWY72SO”,
“Type”: “purchaseDeclined”,
“Data”: {
“Id”: “trn_VL82N3ZHD1”,
“Status”: “Declined”,
“Amount”: “10.55”,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“DeclineCode”: “DeclinedByThreeDSecure”,
“DeclineMessage”: “Declined by 3D Secure.”,
“Created”: “2020-11-25T10:05:28.407905”
},
“Created”: “2020-11-25T10:05:55.551186Z”
}

CaptureCaptured

{
“Id”: “evn_78BAWY72SO”,
“Type”: “purchaseCaptured”,
“Mode”: “Test”,
“Data”: {
“Id”: “trn_VL82N3ZHD1”,
“Status”: “Captured”,
“Amount”: “10.55”,
“Currency”: “EUR”,
“Recurring”: true,
“FirstRecurringTransactionId”: “trn_VL82N3ZH4G”,
“Reference”: “ORD24234”,
“Created”: “2020-11-25T10:05:28.407905”
},
“Created”: “2020-11-25T10:05:55.551186Z”
}

CapturePartialyRefunded

{
“Id”: “evn_j23ja9275i”,
“Mode”: “Test”,
“Type”: “capturePartialyRefunded”,
“Data”: {
“Id”: “trn_hqg6xgnq3c”,
“Status”: “PartiallyRefunded”,
“Amount”: “3.5”,
“RemainingAmount”: 2.5,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2021-01-06T17:34:24.994751”
},
“Created”: “2021-01-06T17:34:30.8503693Z”
}

CaptureRefunded

{
“Id”: “evn_j23ja9275i”,
“Mode”: “Test”,
“Type”: “captureRefunded”,
“Data”: {
“Id”: “trn_hqg6xgnq3c”,
“Status”: “PartiallyRefunded”,
“Amount”: “3.5”,
“RemainingAmount”: 0,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2021-01-06T17:34:24.994751”
},
“Created”: “2021-01-06T17:34:30.8503693Z”
}

CaptureReversed

To simulate a Capture Reversed, use the following POST request with the Capture Transaction ID:

POST https://api.quaife.net/v1/transactions/{{transactionId}}/reversals

{
“Id”: “evn_hbfeixnxwa”,
“Mode”: “Test”,
“Type”: “captureReversed”,
“Data”: {
“Id”: “trn_a58528qofa”,
“Status”: “Reversed”,
“Amount”: “3.5”,
“Currency”: “EUR”,
“Reference”: “ORD24234”,
“Created”: “2021-01-06T17:37:17.748094”
},
“Created”: “2021-01-06T17:37:22.6665207Z”
}

Refund webhooks

Webhooks sent for the Refund transaction type.

RefundCaptured

When a transaction is refunded, a new Transaction ID will be generated and can be viewed in Transaction Lookup. See API References > Refunds for more information

{
“Id”: “evn_uh74dznf2a”,
“Mode”: “Test”,
“Type”: “refundCaptured”,
“Data”: {
“Id”: “ref_lhhc0zeh8u”,
“Status”: “Captured”,
“Amount”: “3.50”,
“Currency”: “EUR”,
“Reference”: “ORD-2354234”,
“Created”: “2021-01-06T17:34:30.7945511Z”
},
“Created”: “2021-01-06T17:34:30.8089935Z”
}

Reversal webhooks

When posting a Reversal request, another transaction is generated of type “Reversal”. This transaction will include the following webhook:

{
“Id”: “evn_eod79yryzk”,
“Mode”: “Test”,
“Type”: “reversalCaptured”,
“Data”: {
“Id”: “rev_v4esaiif0d”,
“Status”: “Captured”,
“Amount”: “3.58”,
“Currency”: “EUR”,
“Reference”: “ORD-2354234”,
“Created”: “2021-01-06T17:37:22.6240057Z”
},
“Created”: “2021-01-06T17:37:22.6351251Z”
}

Payout webhooks

Webhooks sent for the Payout transaction type.

PayoutCaptured

{
“id”: “evn_alaiewrtui”,
“mode”: “Test”,
“type”: “payoutCaptured”,
“data”: {
“id”: “po_1zplg5v4jt”,
“status”: “Captured”,
“paymentMethod”: “DIRECTCREDIT”,
“amount”: “100.00”,
“currency”: “INR”,
“reference”: “120193001A1471101833”,
“created”: “2023-06-21T08:35:55.317743”
},
“created”: “2023-06-21T11:24:55.3759175Z”
}

PayoutDeclined

{
“id”: “evn_ti7cq4ztdi”,
“mode”: “Test”,
“type”: “payoutDeclined”,
“data”: {
“id”: “po_qh3o94asdm”,
“status”: “Declined”,
“paymentMethod”: “DIRECTCREDIT”,
“amount”: “100.00”,
“currency”: “INR”,
“reference”: “112263001A1270368719”,
“declineCode”: “declinedByAcquirer”,
“declineMessage”: “Declined by acquirer.”,
“created”: “2023-06-20T16:31:14.705271”
},
“created”: “2023-06-21T02:28:41.7920893Z”
}

MERCHANT

Should you be interested in becoming a merchant, then please fill out the short form below and one of our specialists will be in touch shortly.

SIGN UP

We are delighted that you are considering using Quaife as your payment partner. Fill in the form below & let’s get started.