Apple Pay for Web

Configure Apple Pay into your website to accept payments in Safari and supported third-party browsers on Apple devices.

The following sections explain how to configure Apple Pay on your website.

Prerequisites

Make sure you have the following before you configure Apple Pay and start accepting payments on your website:

Supported Payment Methods

Supported Cards

Merchant Capabilities

Unsupported Payment Methods

  • In-App payments

  • Recurring payments

  • Split shipment

  • Voids/Refunds through Apple Pay

Getting Started

Xplor Pay manages the Merchant Validation process for you by creating an Apple Merchant ID and CSR. For more information, see Apple Developer Documentation.

Registering a Domain using Merchant Portal

To register a domain:

  1. Go to the Merchant Portal.

  2. Navigate to Virtual Terminal > VT Settings > Apple Pay for Web.

  3. Download the registration file.

  4. Host this file on your website to complete the registration.

Registering a Domain using Apple Pay for Web endpoint

To register a domain:

  1. Use the POST method with Apple Pay for Web API endpoint to register the domain or domains you’ll use with Apple Pay.

  2. Host the verification file provided by Xplor Pay to you on the following URL, replacing [DOMAIN_NAME] with your domain name.

URL: https://[DOMAIN_NAME]/.well-known/apple-developer-merchantid-domain-association

Verifying your domain with Apple

To verify your domain with Apple:

  1. Send a notification to Xplor Pay to request domain verification with Apple after hosting the file at the appropriate URL.

  2. You will receive confirmation after successful domain verification with Apple from Xplor Pay.

Configuring Apple Pay for Web

To configure Apple Pay into your website:

  1. Add the JavaScriptSDK.init method to allow Apple Pay.

ClearentSDK.init({
    "pk": "YOUR_PUBLIC_KEY_HERE",
    "enableApplePay": true
});

The following table describes the fields in the JavaScriptSDK.init method:

Name
Data type
Required?
Description

pk

String

Required

Your public API key issued by Xplor Pay to authenticate the SDK.

enableApplePay

Boolean

Required

Enables Apple Pay functionality when you set it to true.

  1. Add the applePayRequest object to the JavaScriptSDK.init method.

ClearentSDK.init({
    "pk": "YOUR_PUBLIC_KEY_HERE",
    "enableApplePay": true,
    "applePayRequest": {
        "total": {
            "label": "Bob's Canoes",
            "amount": "50.25",
            "type": "final"
        }
    }
});

The following table describes the fields in the applePayRequest object:

Name
Data type
Required?
Description

applePayRequest.total

String

Required

Defines the total transaction amount and merchant label that appear in the Apple Pay sheet.

total.label

String

Required

The merchant’s name displayed to customers in the Apple Pay sheet. For example, Bob’s Canoes.

total.amount

String

Required

The total transaction amount to be charged. For example, 50.25

total.type

String

Required

Indicates the type of transaction amount. Use final for a fixed total.

See the Apple Pay on the Web Demo for additional objects you can use in your Apple Pay payment sheet.

Processing Payments with Apple Pay

The JavaScript SDK handles Apple Pay token and convert it into the mobile JSON Web Token (JWT).

To process the payment with Apple Pay:

  1. Add the ClearentTokenSuccess and ClearentTokenError functions to your integration to receive feedback containing the mobile JSON Web Token (JWT) for processing payments.

function ClearentTokenSuccess(raw, json) {
    console.log("ClearentTokenSuccess");
    console.log(raw);
    console.log(json);
    console.log("-----------------------------------------------");
    console.log("now you can send the token to your server");
    console.log("to complete the transaction via mobile-gateway");
    console.log("-----------------------------------------------")
}
function ClearentTokenError(raw, json) {
    console.log("ClearentTokenError");
    console.log(raw);
    console.log(json);
}
  1. Use HTTPS methods to send the mobile payment API requests using the mobile JSON Web Token (JWT) from your server.

Testing Apple Pay for Web

Test Apple Pay transactions offline on your website using Apple’s sandbox testing guide.

Last updated

Was this helpful?