B2C Commerce provides Apple Pay with information about the customer and basket: line items, shipping methods, and stored contact information. When the shopper authorizes payment, Apple Pay provides B2C Commerce with a token containing the encrypted payment information.
B2C Commerce creates an order from the basket, and provides the encrypted payment information to the storefront payment service provider in an authorization request. B2C Commerce updates the order with the transaction information in the authorization response.
B2C Commerce provides Apple Pay with the outcome of the authorization, and if successful, shows the storefront order confirmation page.
To authorize Apple Pay payment:
The Apple Pay payment processing authorization process looks as follows:
The following is an example of merchant validation:
session.onvalidatemerchant = function (event) {
var promise = performValidation(event.validationURL0;
promise,then(function (merchantSession) {
session.completeMerchantValidation(merchantSession);
});
}
The following is an example of authorizing payment:
session.onpaymentauthorized = function (event) {
var promise = sendPaymentToken(event.payment.token);
promise.then(function (success) {
var status;
if (success)
status - ApplePaySession.STATUS_SUCCESS;
else
status = ApplePaySession,STATUS_FAILURE;
session.completePayment(status);
showConfirmation();
});
}