Apple Pay
To support the Apple Pay payment method in Hosted Checkout, it must be enabled for the merchant in the TNS Merchant Configuration. This can be activated through the Merchant Portal. Additionally, the client-side script must implement the Apple Pay callback methods as part of the Hosted Checkout initialization.
How It Works
The Hosted Checkout will display Apple Pay buttons within the iframe. When the customer clicks on the Apple Pay button, the Apple Pay checkout page appears. The customer chooses a card from his/her Apple Wallet to use for this payment transaction. After the payment is completed at the Apple Pay checkout, the onApplePayAuthorized callback is specified in the hostedCheckoutSdk.initialize method will trigger the transaction response.
If the transaction type is PAYMENT, The TNS system immediately captures the authorization.
If the transaction type is PRE_AUTH, the TNS system will not capture the payment immediately. Instead, the merchant can capture the transaction later through the Merchant Portal.
The callback methods are
- onApplePayAuthorized
- onApplePayError
- onApplePayCanceled
onApplePayAuthorized
This callback is invoked on a successful Apple Pay transaction
{
"type": "APPLE_PAY_AUTHORIZED",
"data": {
"authCode": "OK3099",
"approvedAmount": "39.13",
"accountFirst6": "481436",
"accountLast4": "5999",
"hostNetwork": "1",
"expiryMonth": "08",
"expiryYear": "2030",
"cardHolderName": "ApplePay",
"clientTransactionId": "5cd4359c-a5eb-4151-a838-19e0fabefde8",
"transactionDateUtc": "2024-08-02T16:19:56.173Z",
"tnsResponseCode": "00",
"tnsResponseText": "TRANSACTION_APPROVED",
"hostResponseCode": "00",
"hostResponseText": "APPROVAL",
"token": "8773771191205999",
"status": "success",
"stan": "503470",
"transactionId": "2e0ad975-54d5-4a41-8234-9beca177f26f",
"requestId": "dacd153e-7c71-956a-8f38-ff01ba3810b9",
"successful": true
}
}
onApplePayError
This callback is invoked when the there is an error in process the Apple Pay transaction.
The error object is passed as a parameter in the callback.
onApplePayCanceled
This callback is invoked when user cancels the transaction in the Apple Pay checkout page. There is no parameters for this callback method.
On this page
- Apple Pay