Webhook Details
The Webhook functionality allows you to receive a POST
from DNA Payments with the details for that transaction enclosed as JSON content. The HTTPS URL you provide in the Start Transaction request must conform to the following criteria:
Attribute | Criteria |
---|---|
Url | HTTPS address as supplied in the Webhook URL |
Authentication | Anonymous |
Supported Media Types | application/json |
HTTP Method | POST |
Supports Filtering | No |
Request Type | Transaction Information |
With the following Request Header Information:
Key | Value |
---|---|
Accept | application/json |
Content-Type | application/json; charset=utf-8 |
Content-Digest | |
Signature-Input | |
Signature |
All messages are sent as UTF 8 encoded JSON messages and will not contain any field that is ‘null’.
Header Fields
All header fields conform to the RFC 8941 Structured Values for HTTP standard. Whilst the standard supports various header fields, the key ones that are of interest for the webhook handling are:
Field | Header Name | RFC 8941 Data Type | Description |
---|---|---|---|
Content Digest | Content-Digest | Dictionary | This contains a single entry that represents the hash of the message. The key of the field identifies the hash algorithm, and the value is the hash of the message. DNA Payments will support returning the hash as a SHA-256 hash using PKCS#1 padding. |
Content Length | Content-Length | Long | This is the length of the message content. |
Content Type | Content-Type | List | This is the content type and any associated parameters. |
Signature Input | Signature-Input | Dictionary | This provides the details of what fields make up a given signature. The key indicates the signature identifier. The value contains the list of fields and any associated parameters. The signature identifier that is to be processed will be identified as ‘sig1’. |
Signature | Signature | Dictionary | This provides the signature details. The key indicates the signature identifier. The value contains the signature. The signature identifier that is to be processed will be identified as ‘sig1’. |
Details of how to validate the signature we supply can be found in the Signature Verification section.
Webhook Response Payload
The Webhook Response is a JSON payload, in the same format as a GET
/transaction Response. Please refer to the table in the API Messages > GET transaction section for more information.
Webhook Payload Example
Webhook payloads are only sent when the transactionStatus
field is Complete
. Below are three example payloads, showing a successful, cancelled and declined payment attempt.
- Accepted
- Cancelled
- Declined
{
"uti": "1d027a88-5821-4442-bb4a-14123fc3fac9",
"transType": "SALE",
"transApproved": true,
"transPartiallyApproved": false,
"transCancelled": false,
"amountTrans": 150,
"amountGratuity": 0,
"amountCashback": 0,
"cvmSignatureRequired": false,
"cvmPinVerified": false,
"transCurrencyCode": "GBP",
"terminalId": "31297280",
"merchantId": "12345678",
"softwareVersion": "1.00.50-11136",
"receiptNumber": "36",
"retrievalReferenceNumber": "000036170001",
"paymentId": "39013/85/10042023153038152",
"responseCode": "00",
"stan": "85",
"authorisationCode": "123ABC",
"merchantTokenId": "koAu92lmmn7Vt1gybo5mqaA3fIci0vmRQvpfnwpDegsfMQ==",
"cardPan": "************0102",
"cardStartDate": "0401",
"cardScheme": "MasterCard",
"cardPanSequenceNumber": "001",
"cardType": "CTLS",
"emvAid": "A0000000041010",
"emvTsi": "0000",
"emvTvr": "0000008001",
"emvCryptogram": "6AFC0FCCAFAEE14D",
"emvCryptogramType": "ARQC",
"reference": "Test3",
"merchantName": "Test",
"transDateTime": "2023-04-10T15:30:00Z",
"createdDateTime": "2023-04-10T15:30:15.0462675Z",
"merchantStoreId": 14759,
"status": "Complete"
}
{
"uti": "e9665b4b-150e-45b6-96a1-1b2c0c28c067",
"transType": "SALE",
"transApproved": false,
"transPartiallyApproved": false,
"transCancelled": true,
"amountTrans": 150,
"amountGratuity": 0,
"amountCashback": 0,
"cvmSignatureRequired": false,
"cvmPinVerified": false,
"transCurrencyCode": "GBP",
"terminalId": "31297280",
"merchantId": "12345678",
"softwareVersion": "1.00.50-11136",
"receiptNumber": "37",
"retrievalReferenceNumber": "000037170001",
"stan": "0",
"cardPan": "************0102",
"cardStartDate": "0401",
"cardScheme": "MasterCard",
"cardPanSequenceNumber": "001",
"cardType": "EMV",
"emvAid": "A0000000041010",
"emvTsi": "C000",
"emvTvr": "0000000000",
"emvCryptogram": "",
"reference": "Test3",
"merchantName": "Test",
"transDateTime": "2023-04-11T08:10:00Z",
"createdDateTime": "2023-04-11T08:10:25.5168273Z",
"merchantStoreId": 14759,
"status": "Complete"
}
{
"uti": "8975de1d-ddc2-4b57-b934-bfee43b85777",
"transType": "SALE",
"transApproved": false,
"transPartiallyApproved": false,
"transCancelled": false,
"amountTrans": 150,
"amountGratuity": 0,
"amountCashback": 0,
"cvmSignatureRequired": false,
"cvmPinVerified": true,
"transCurrencyCode": "GBP",
"terminalId": "31297280",
"merchantId": "12345678",
"softwareVersion": "1.00.50-11136",
"receiptNumber": "38",
"retrievalReferenceNumber": "000038170001",
"paymentId": "39013/87/11042023081649826",
"responseCode": "05",
"stan": "87",
"merchantTokenId": "koAu92lmmn7Vt1gybo5mqaA3fIci0vmRQvpfnwpDegsfMQ==",
"cardPan": "************0102",
"cardStartDate": "0401",
"cardScheme": "MasterCard",
"cardPanSequenceNumber": "001",
"cardType": "EMV",
"emvAid": "A0000000041010",
"emvTsi": "E800",
"emvTvr": "0000008000",
"emvCryptogram": "B3E51E2A101EE360",
"emvCryptogramType": "AAC",
"reference": "Test3",
"merchantName": "Test",
"transDateTime": "2023-04-11T08:16:00Z",
"createdDateTime": "2023-04-11T08:16:15.4406236Z",
"merchantStoreId": 14759,
"status": "Complete"
}