Flow of Apple Pay Web Transactions Using Merchant Decryption {#applepay-web-txn-merchant-decrypt}
=================================================================================================

1. When the customer chooses to pay with Apple Pay, you use the Apple Pay JavaScript to request the encrypted payment data from Apple.

2. Apple uses the Secure Element to create a *payment token* and encrypt the token's *payment data* before it sends your application using the `onpaymentauthorized` event handler.

   * The payment token is the `ApplePayPaymentToken` structure.
   * The payment data is the paymentData field of the `ApplePayPaymentToken` structure.

   For more information, see [Apple Pay on the Web Interactive Demo](https://applepaydemo.apple.com/ "").

3. You forward the encrypted payment data to your order management system to decrypt. For information on decryption, see the [Payment Token Format Reference](https://developer.apple.com/library/archive/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.md#//apple_ref/doc/uid/TP40014929-CH8-SW1 "") article in the Apple Pay Developer Documentation.

4. Using the `Cybersource` API, you submit the authorization request and include the decrypted payment data. See [Authorization Service](/docs/cybs/en-us/apple-pay/developer/barclays/rest/applepay/applepay-txns-intro/applepay-auth-intro.md "").

5. `Cybersource` forwards the information to the payment network, which includes your processor and the relevant payment card company. IMPORTANT
   Use the ` Business Center ` or one of the ` Cybersource ` API services to capture, credit, or void the authorization.

