Apple Pay on the Web Payment Authorization

Salesforce B2C Commerce provides Apple Pay with information about the customer and basket: line items, shipping methods, and stored contact information.

Apple Pay provides B2C Commerce with information to update the basket: the selected billing address, shipping address, and shipping method.

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:

  1. The shopper clicks or taps the Buy with Apple Pay button.
  2. B2C Commerce creates the payment request.
  3. B2C Commerce creates a merchant session, requested from the B2C Commerce Web Server to Apple.
  4. The session is returned to B2C Commerce and is forwarded with the payment request.
  5. The app shows the Apple Pay sheet.
  6. The shopper uses their Touch ID or passcode.
  7. Payment data is generated.

The Apple Pay payment processing authorization process looks as follows:

Merchant Validation

The following is an example of merchant validation:

session.onvalidatemerchant = function (event) {
   var promise = performValidation(event.validationURL0;

   promise,then(function (merchantSession) {
      session.completeMerchantValidation(merchantSession);
});
}
  1. A validmerchant DOM event is dispatched to the session.
  2. The event has a validationURL property.
  3. Validation is performed.
  4. Call completeMerchantValidation.

Authorize Payment

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();
   });
}

Related Links

Apple Pay On the Web

Apple Pay On the Web Process

Apple Pay On the Web Supported Hardware

Apple Pay On the Web Supported Locales

Enable Apple Pay in Your Storefront

Configuring Apple Pay On the Web in Business Manager

Apple Pay Button Injection

Enable Apple Pay On the Web Using a LINK Cartridge

Enable Apple Pay On the Web for PSPs

Apple Pay On the Web Payment Authorization

Apple Pay On the Web Integration into B2C Commerce Processes