Payment Request
The final step in Apple Pay Direct is to send the Apple Pay Token to DNA as part of a Payment Request. A full range of fields available in this request can be seen here however for an Apple Pay only request, please see the following example:
Payment Request Code Example
{
"auth": {
"access_token": "rfdRe$-NQ1cI0vNn.uV*V1LUlNA-Td!cSq7gdh8ZyNnK7q8Rgn1frz=S00eVJvMG",
"expires_in": 7200,
"refresh_token": "KwAteEStSWSWi7hj8fYZW0aANeRywCXP-WUsKxD*V3Ni*Y2Laclhv$N1HvedZJot",
"scope": "payment integration_hosted integration_embedded integration_seamless",
"token_type": "Bearer"
},
"currency": "GBP",
"description": "Car Service",
"paymentSettings": {
"returnUrl": "https://test-pay.dnapayments.com/checkout/success.html",
"failureReturnUrl": "https://test-pay.dnapayments.com/checkout/failure.html",
"callbackUrl": "https://pay.dnapayments.com/checkout",
"failureCallbackUrl": "https://testmerchant/order/1123/fail",
"terminalId": "b553ffcc-7df4-47b1-887b-fa4108af9c85"
},
"customerDetails": {
"accountDetails": {
"accountId": "uuid000001"
},
"billingAddress": {
"firstName": "John",
"lastName": "Doe",
"addressLine1": "Fulham Rd",
"postalCode": "SW6 1HS",
"city": "London",
"country": "GB"
},
"deliveryDetails": {
"deliveryAddress": {
"firstName": "John",
"lastName": "Doe",
"streetAddress1": "Fulham Rd",
"streetAddress2": "Fulham",
"postalCode": "SW6 1HS",
"city": "London",
"phone": "0475662834",
"region": "UKI",
"country": "GB"
}
},
"email": "demo@dnapayments.com"
},
"invoiceId": "1636987218263",
"amount": 24,
"paymentMethod": "applepay",
"cardDetails": {
"cryptogram": {
"token": {
"paymentData": {
"data": "ygxJALtd6JSGK/9bAEG47QUqXz9vDcDBObS1JjTQEoEqxJrY47cXgxweKcH2VV3vRTngSixRkMs9pxzRM0gfrRXLcP+5sMBNPQHs+RicjvGUU02mrQulOzKh7usKA2kHGuLxGlsd3VUyGDOBnQh1J1GWEAx0zGtgG9RCrkEuZPrr0ybxpNttYgZxPxV2LoRKxqG5OOowZi5Q7wEzFV3+teRf8rh4j3+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dz7VrqeTEI8wHNQt7EgcHtHp/gxA=",
"ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/jIN+vVsnwSlmoSG1RWfUSkTyVMhrc2Zxl6qoPCoF8zZzvzb22w7AK2WDX4w83Xqe3cnq/YaVR8P1trc8WeO1Q==",
"transactionId": "0843c5d4d0a35ae9c758494a7749f36137d0cfc86ee4380dbcb8c20bee2f01f9"
},
"version": "EC_v1"
},
"paymentMethod": {
"displayName": "Visa 0224",
"network": "Visa",
"type": "debit"
},
"transactionIdentifier": "0843C5D4D0A35AE9C758494A7749F36137D0CFC86EE4380DBCB8C20BEE2F01F9"
}
},
"cardholderName": "John Doe"
}
}
Payment Request
Most of these fields are documented elsewhere, however the key new components of this request are in the table below.
Payment Request | |||
---|---|---|---|
Field Name | State | Data Type | Description |
paymentMethod | Mandatory | String | This must be set to applepay |
cardDetails | Mandatory | Object | See the cardDetails table. |
cardDetails
Card Details | |||
---|---|---|---|
Field Name | State | Data Type | Description |
cryptogram | Mandatory | Object | The cryptogram contains the token Object ONLY. This contains the data received from Apple in earlier steps. It should be passed in as shown above. |
cardholderName | Optional | String | The name of the shopper. |
Payment Response Code Example
You will receive a response at the returnUrl
specified in the paymentSettings
block above and as documented in the Ecommerce section.
{
"accountId": "uuid000001",
"amount": 24,
"authCode": "021464",
"authDateTimeUTC": "2021-11-15T14:43:07.240068545Z",
"avsHouseNumberResult": "Matched",
"avsPostcodeResult": "Matched",
"cardExpiryDate": "12/23",
"cardPanStarred": "***************5434",
"cardSchemeId": 11,
"cardSchemeName": "VISA",
"cardTokenId": "RHRwyfpN6EegGVDXD19fcSZifIMFkwnJkE9Jmo2N/okfMQ==",
"cardholderName": "John Doe",
"cscResult": "Not Set",
"currency": "GBP",
"eftPaymentId": "36006/1274/15112021144307999",
"errorCode": 0,
"id": "cb66ebf0-f61c-4367-8783-c13e743d693a",
"invoiceId": "1636987218263",
"message": "Completed successfully",
"payerAuthenticationResult": "-/-",
"paymentMethod": "applepay",
"responseCode": "00",
"rrn": "b9c8dc8d-428e-424f-9742-0bebca1b73d8",
"settled": true,
"stan": 1294,
"status": "succeeded",
"success": true
}
Payment Response Fields
These fields are documented below. None of these are specific to Apple Pay.
paymentResult | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Field Name | Data Type | Description | ||||||||||||||||||||||||||||
accountId | String | Unique reference for the store processing the transaction, as passed in the request. | ||||||||||||||||||||||||||||
amount | Decimal | Total amount of the order including decimal places where applicable. 'Whole' amounts (e.g. '1') on a GBP account represents £1.00. | ||||||||||||||||||||||||||||
authCode | String | Authorisation code issued for the transaction. | ||||||||||||||||||||||||||||
authDateTimeUTC | String | Date and time of when the transaction was authorised with the acquirer. | ||||||||||||||||||||||||||||
avsHouseNumberResult | String | Confirms the result of the Address Verification System (AVS) house number check.
| ||||||||||||||||||||||||||||
avsPostcodeResult | String | Confirms the result of the Address Verification System (AVS) post code check.
| ||||||||||||||||||||||||||||
cardExpiryDate | String | Expiry date for the card used in the transaction. Provided in the “MM/YY” format. | ||||||||||||||||||||||||||||
cardholderName | String | Cardholder name as entered on the payment form. | ||||||||||||||||||||||||||||
cardIssuingCountry | String | Country where the card was issued. This information will only be returned when this can be determined. This information is subject to change and as such we recommend only using this data as a guide. | ||||||||||||||||||||||||||||
cardPanStarred | String | Starred PAN for the card used in the transaction - for example ************9909. | ||||||||||||||||||||||||||||
cardSchemeId | Integer | Optomany Card Scheme ID for the card used in the transaction. | ||||||||||||||||||||||||||||
cardSchemeName | String | Name of the Card scheme for the card used in the transaction. | ||||||||||||||||||||||||||||
cardTokenId | String | Optomany Token ID for the card presented. | ||||||||||||||||||||||||||||
charitableDonation | Decimal | Amount of any charitable donation awarded by the consumer during the transaction process. | ||||||||||||||||||||||||||||
cscResult | String | Confirms the result of the Card Security Code (CSC) validation check.
| ||||||||||||||||||||||||||||
currency | String | Currency of the transaction.
| ||||||||||||||||||||||||||||
errorCode | Integer | Provides additional detail should an error have occurred with the transaction.
| ||||||||||||||||||||||||||||
id | String | Unique transaction ID. This ID should be stored as it is required for later transaction actions. | ||||||||||||||||||||||||||||
invoiceId | String | Order/invoice/transaction/basket number generated by the host website, as passed in the request. | ||||||||||||||||||||||||||||
message | String | Message confirming the processing result of the transaction request. | ||||||||||||||||||||||||||||
optomanyTerminalId | String | Optomany Terminal ID used when authorising the transaction. | ||||||||||||||||||||||||||||
payerAuthenticationResult | String | Result of the Payer Authentication process provided in the following formatenrollment result/authentication result The possible results are detailed below.
* 3D Secure v2 Only As an example an enrolled card which has been fully authenticated will be returned as Y/Y | ||||||||||||||||||||||||||||
paymentMethod | String | Payment method used for the transaction.
| ||||||||||||||||||||||||||||
responseCode | String | Returned by the acquirer detailing the result of the transaction. A full list of Response Codes can be found here. | ||||||||||||||||||||||||||||
rrn | String | Unique reference allocated by Optomany to the authorisation. | ||||||||||||||||||||||||||||
schemeReferenceData | String | Reference data from the card scheme, returned in the authorisation response. This data may not always be present. | ||||||||||||||||||||||||||||
settled | Boolean | Confirms whether the transaction has been submitted for overnight settlement.
| ||||||||||||||||||||||||||||
signature | String | Signature generated for the transaction, for more information on this see Validating the Signature. | ||||||||||||||||||||||||||||
success | Boolean | Confirms whether the transaction has been successful.
|