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:
Devices compatible with Apple Pay.
HTTPS enabled for both development and production environments.
A valid SSL certificate for your domain.
Transport Layer Security (TLS) 1.2 or later and a supported cipher suite for your server.
Ensure Apple Pay is configured and enabled on your production server.
We recommend implementing manual card entry in the JavaScript SDK as a fallback.
Supported Payment Methods
Payment and address information are required to process payments using Apple Pay on your website.
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:
Go to the Merchant Portal.
Navigate to Virtual Terminal > VT Settings > Apple Pay for Web.
Download the registration file.
Host this file on your website to complete the registration.
Registering a Domain using Apple Pay for Web endpoint
To register a domain:
Use the POST method with Apple Pay for Web API endpoint to register the domain or domains you’ll use with Apple Pay.
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
The URL with your [DOMAIN_NAME]
must be publicly accessible to allow Apple to verify the file.
Verifying your domain with Apple
To verify your domain with Apple:
Send a notification to Xplor Pay to request domain verification with Apple after hosting the file at the appropriate URL.
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:
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:
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
.
Add the
applePayRequest
object to theJavaScriptSDK.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:
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.
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:
Add the
ClearentTokenSuccess
andClearentTokenError
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);
}
Make sure the ClearentTokenSuccess and ClearentTokenError functions are added to your JavaScript integration to avoid unnecessary rework. If you haven’t integrated them yet, see the JavaScript SDK for integration steps.
Use HTTPS methods to send the mobile payment API requests using the mobile JSON Web Token (JWT) from your server.
Make sure you have the following to process the Apple Pay transaction using Xplor Pay mobile payment API on your website:
✅ API key issued by Xplor Pay
✅ Mobile JSON Web Token (JWT)
Don’t expose the API key issued by Xplor Pay in your website code or client-side scripts.
Testing Apple Pay for Web
Test Apple Pay transactions offline on your website using Apple’s sandbox testing guide.
Last updated
Was this helpful?