Skip to main content

Documentation

Creating an Apple Pay Payment on a Customized Checkout Page

Create Apple Pay payments on your customized hosted pages.

Prerequisites:

Procedure

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

  1. Retrieve an Apple Pay session. See Retrieve Apple Pay Session.

  2. The payment is authorized by Apple Pay via its onpaymentauthorized event handler.

  3. Create the payment as described in 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

    {
        "amount": 10,
        "currency": "USD",
        "description": "Transaction with Apple Pay digital wallet",
        "payment_method": {
            "type": "by_visa_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 event handler. See the Apple Pay Merchant Integration Guide, available from Apple in PDF format.