---
title: "Creating an Apple Pay Payment on a Customized Checkout Page"
source_url: https://docs.rapyd.net/en/creating-an-apple-pay-payment-on-a-customized-checkout-page.html
lang: en
---

# Creating an Apple Pay Payment on a Customized Checkout Page

Create Apple Pay payments on your customized hosted pages.

**Prerequisites:**

- [Customizing Hosted pages with Apple Pay](https://docs.rapyd.net/en/customizing-hosted-pages-with-apple-pay.md "Customizing Hosted Pages with Apple Pay").

Procedure

Do the following steps for each ‘Create Payment’ with Apple Pay request:

1. Retrieve an Apple Pay session. See [Retrieve Apple Pay Session](https://docs.rapyd.net/en/retrieve-apple-pay-session.md "Retrieve Apple Pay Session").
2. The payment is authorized by Apple Pay via its [onpaymentauthorized](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778020-onpaymentauthorized) event handler.
3. Create the payment as described in [Create Payment](https://docs.rapyd.net/en/create-payment.md "Create Payment").

   - Set `payment_method.type` to the payment method type.
   - Set `payment_method.digital_wallet.details.token` to the entire `token` object that you got from Apple Pay, without any changes. The example here has truncated some of the long values for clarity.

   Request URL: post https://sandboxapi.rapyd.net/v1/payments

   Request Body

   ```json
   {
       "amount": 10,
       "currency": "USD",
       "description": "Transaction with Apple Pay digital wallet",
       "payment_method": {
           "type": "de_mastercard_card",
           "address": null,
           "digital_wallet": {
               "type": "apple_pay",
               "details": {
                   "token": {
                       "paymentData": {
                           "data": "V7OcjttPJnUJaQH7x7OjbIeZSINuc...pm+2RquBArCp71Z9CPSGwQ6bfcq09Dwsw3WJ0RGg=",
                           "signature": "MIAGCSqGSIb3DQEHAqCAM...xCzAJBgNVBAY3Sbrb7MpYRdEAAAAAAAA=",
                           "header": {
                               "publicKeyHash": "L6vppo38t31Q/9npxRy/xbA1+cs13h1LV+pMO/FYwvo=",
                               "ephemeralPublicKey": "MFkwEwYHKoZI...sum3onbZcAU/4Q==",
                               "transactionId": "4f4fac7a1...a6a8ba2c0e8c5"
                           },
                           "version": "EC_v1"
                       },
                       "paymentMethod": {
                           "displayName": "MasterCard 1512",
                           "network": "MasterCard",
                           "type": "credit"
                       },
                       "transactionIdentifier": "4F4FAC7A10474...8BA2C0E8C5"
                   }
               }
           }
       }
   }
   ```
4. Pass the payment status to Apple Pay (success/fail) via its [completepayment](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778012-completepayment) event handler. See the **Apple Pay Merchant Integration Guide**, available from Apple in PDF format.
