Using Apple Pay for Web
Last updated
Last updated
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.
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.
Use an SSL-certified domain.
Use a server with Transport Layer Security (TLS) protocol version 1.2 or later and a supported cipher suite.
Refer to the for setting up your production environment.
Implement the manual card entry of the JavaScript SDK solution.
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)
In-App Payments
Recurring Payments
Split Shipment
Voids/Refunds through Apple Pay
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.
Create a container using the script below on your website to add the Apple Pay button with default style.
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.
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.
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
Apple requires an offline test implementation of Apple Pay for apps, websites, and point-of-sale systems.
You can calculate final transaction cost using customer’s payment method, billing address, shipping address, and shipping method:
Refer the following example to implement the optional handlers in your payment sheet:
Example:
Note: Clearent manages the process for you by creating an Apple Merchant ID and CSR. For more information, see .
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 .
Note: Before moving to the next step, ensure you have integrated with Clearent’s JavaScript SDK to avoid an error. For more information, see .
You can test your Apple Pay transaction using the reference.
If you want to calculate the final transaction cost using payment method, add the optional handler in your payment sheet.
If you want to calculate the final transaction cost using shipping method, add the optional handler in your payment sheet.
If you want to calculate the final transaction cost using billing address and shipping address, add the optional handler in your payment sheet.
Note: You can add the optional handler, which triggers when the customer clicks the Cancel button, to remove the payment page.