Using the Apple Pay for Web
Apple Pay for Web allows you to make secure payments using the Safari browser.
The following articles help you with the Apple Pay payment method.
Prerequisites
Follow the prerequisites below before you incorporate Apple Pay on your website:
Use the macOS version 10.12.1 or later for MacBook.
Use the iOS version 10.1 or later for iPhone.
Use the Safari browser on your Apple device.
Ensure your server supports Apple Pay.
Serve your application over HTTPS in both development and in production environments.
Ensure your domain have a valid SSL certificate.
Ensure your server support the Transport Layer Security (TLS) protocol version 1.2 or later and one of the cipher suites.
Refer to the Apple Server Configurations for setting up your production environment.
Implement manual card entry solution using Clearent’s JavaScript SDK.
Supported Payment Methods
You must have the payment and address information of your customers who use Apply Pay.
Supported Cards
Visa
MasterCard
American Express
Discover
Merchant Capabilities
Credit cards (Visa or Mastercard)
Debit cards (Visa or Mastercard)
Unsupported Payment Methods
In-App Payments
Recurring Payments
Split Shipment
Voids/Refunds through Apple Pay
Getting Started
Note: Clearent manages the Merchant Validation process for you by creating an Apple Merchant ID and CSR. For more information, see Apple Developer Documentation.
Follow the below steps to register and verify your domain with Apple:
Provide your domain(s) that will be used for Apple Pay.
Host the verification file provided by Clearent to you on the following URL, replacing [DOMAIN_NAME] with your domain name.
URL: https://[DOMAIN_NAME]/.well-known/apple-developer-merchantid-domain-association
Note: This URL must be publicly accessible to allow Apple to verify the file.
Send a notification to Clearent after you host the file with appropriate URL, to request to register and verify your domain with Apple.
You will receive confirmation after successful domain verification with Apple from Clearent.
Setting Up Apple Pay
Adding the Apple Pay Button
Create a container using the script below on your website to add the Apple Pay button with default style.
Note: Apple provides several types of buttons so that you can choose the button type that fits best with the terminology and flow of your purchase or payment experience. For more information on Apple Styling Guidelines, see Apple Pay.
You can use the following example to request button type for your website.
Add the function below to your website to check whether your customer uses Apple Pay.
This function helps you decide whether to display the Apple Pay button in the customer’s browser.
Configuring the onClick Event
Follow the below steps to configure the onClick event for your payment process:
Configure the onClick
event using the payment sheet object below to start the Apple Pay session.
Clearent’s JavaScript SDK handles the Apple Pay token and converts it into the JWT that you process.
Note: Before moving to the next step, ensure you have integrated with Clearent’s JavaScript SDK to avoid an error. For more information, see Clearent’s JavaScript SDK.
Send the token provided by Clearent to your server using the secure transmission.
Provide the secret API key to Clearent from your server.
Note: Do not provide the secret API key from your website.
Return a successful token response you receive to the JavaScript SDK to handle it appropriately
Offline Testing for Apple Pay
Apple requires an offline test implementation of Apple Pay for apps, websites, and point-of-sale systems.
You can test your Apple Pay transaction using the Sandbox testing reference.
Calculating Final Transaction Cost
You can calculate final transaction cost using customer’s payment method, billing address, shipping address, and shipping method:
If you want to calculate the final transaction cost using payment method, add the onpaymentmethodselected optional handler in your payment sheet.
If you want to calculate the final transaction cost using shipping method, add the onshippingmethodselected optional handler in your payment sheet.
If you want to calculate the final transaction cost using billing address and shipping address, add the onshippingcontactselected optional handler in your payment sheet.
Note: You can add the optional oncancel handler, which triggers when the customer clicks the Cancel button, to remove the payment page.
Refer the following example to implement the optional handlers in your payment sheet:
Example:
Last updated