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 NameStateData TypeDescription
paymentMethodMandatoryStringThis must be set to applepay
cardDetailsMandatoryObjectSee the cardDetails table.

cardDetails

Card Details
Field NameStateData TypeDescription
cryptogramMandatoryObjectThe cryptogram contains the token Object ONLY.

This contains the data received from Apple in earlier steps. It should be passed in as shown above.
cardholderNameOptionalStringThe 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.

Apple Pay Direct Response example
{
"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 NameData TypeDescription
accountIdStringUnique reference for the store processing the transaction, as passed in the request.
amountDecimalTotal amount of the order including decimal places where applicable. 'Whole' amounts (e.g. '1') on a GBP account represents £1.00.
authCodeStringAuthorisation code issued for the transaction.
authDateTimeUTCStringDate and time of when the transaction was authorised with the acquirer.
avsHouseNumberResultStringConfirms the result of the Address Verification System (AVS) house number check.
NotSetHouse Number check was not requested.
NotCheckedHouse Number could not be checked.
MatchedHouse Number matched.
NotMatchedHouse Number did not match.
PartialMatchHouse Number partially matched.
avsPostcodeResultStringConfirms the result of the Address Verification System (AVS) post code check.
NotSetPost Code check was not requested.
NotCheckedPost Code could not be checked.
MatchedPost Code matched.
NotMatchedPost Code did not match.
PartialMatchPost Code partially matched.
cardExpiryDateStringExpiry date for the card used in the transaction. Provided in the “MM/YY” format.
cardholderNameStringCardholder name as entered on the payment form.
cardIssuingCountryString

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.

cardPanStarredStringStarred PAN for the card used in the transaction - for example ************9909.
cardSchemeIdIntegerOptomany Card Scheme ID for the card used in the transaction.
cardSchemeNameStringName of the Card scheme for the card used in the transaction.
cardTokenIdStringOptomany Token ID for the card presented.
charitableDonationDecimalAmount of any charitable donation awarded by the consumer during the transaction process.
cscResultStringConfirms the result of the Card Security Code (CSC) validation check.
NotSetCSC check was not requested.
NotCheckedCSC could not be checked.
MatchedCSC matched.
NotMatchedCSC did not match.
currencyString

Currency of the transaction.

GBPPound Sterling
errorCodeIntegerProvides additional detail should an error have occurred with the transaction.
0No error occurred.
A full list of Error Codes can be found here.
idString

Unique transaction ID.

This ID should be stored as it is required for later transaction actions.

invoiceIdStringOrder/invoice/transaction/basket number generated by the host website, as passed in the request.
messageStringMessage confirming the processing result of the transaction request.
optomanyTerminalIdStringOptomany 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.

EnrollmentAuthentication
Y

Successful.

Y

Successful.

N

Not enrolled.

N

Not authenticated.

A

Attempted.

A

Attempted.

U

Unable to check.

U

Unable to authenticate.

C

Challenge Required*

R

Authentication Rejected*

X

Not Attempted

X

Not Attempted

* 3D Secure v2 Only

As an example an enrolled card which has been fully authenticated will be returned as Y/Y

paymentMethodString

Payment method used for the transaction.

applepayApple Pay
responseCodeStringReturned by the acquirer detailing the result of the transaction. A full list of Response Codes can be found here.
rrnStringUnique reference allocated by Optomany to the authorisation.
schemeReferenceDataStringReference data from the card scheme, returned in the authorisation response.

This data may not always be present.
settledBooleanConfirms whether the transaction has been submitted for overnight settlement.
trueTransaction settled.
falseTransaction not settled.
signatureStringSignature generated for the transaction, for more information on this see Validating the Signature.
successBooleanConfirms whether the transaction has been successful.
trueTransaction approved.
falseTransaction not approved.