Available in🇮🇳 India
Apple Pay is a secure, contactless payment method that lets customers pay using their Apple devices with Face ID/Touch ID authentication. With the Custom Checkout headless SDK, you check Apple Pay eligibility and either let Razorpay render the Apple Pay button or render your own — all on your existing Custom Checkout integration, with no redirect. Know more about Apple Pay.
This integration works with your existing card payment flow: check eligibility, render a button and initiate the payment with one additional app parameter.
Advantages
Advantages
- Accept payments in over 120 currencies from international customers.
- Reduce checkout time with one-touch biometric payments (Face ID/Touch ID).
- Full control of where and how the Apple Pay button appears on your page.
- Razorpay encapsulates device eligibility — no need to integrate the Apple Pay JS API or write capability-detection logic yourself.
- No need to handle Apple certificates or domain verification beyond hosting one file — Razorpay manages the rest.
Prerequisites
Before you begin, ensure you have:- An existing Razorpay Custom Checkout integration.
- Apple Pay enabled and International Payments enabled on your Razorpay account.
- HTTPS on your website — Apple Pay requires a secure context.
- Your API Key Id. Generate API Keys from the Dashboard. Use Live Mode keys to accept real payments.
- Apple Pay domain verification completed for your domain (host the domain association file; Razorpay registers it with Apple).
Integration Steps
Follow the steps given below.1.1 Create an Order on Your Server
An order should be created for every payment.- Create an order using the Orders API. This is a server-side call.
- Pass the returned
order_idto your frontend. This ties the order to the payment and secures the request from tampering.
Request
id (for example, order_XXXXXXXXXX). Pass this to your frontend for SDK initialisation. For the full list of order request and response parameters, see the Create an Order API.
1.2 Load the Custom Checkout Script
Include the Custom Checkout script, preferably in the<head> of your page:
HTML
Handy TipsLoad the script from
https://checkout.razorpay.com/v1/razorpay.js rather than serving a copy. This keeps updates and fixes automatic. Existing Custom Checkout merchants already load this script.1.3 Initialise the SDK
Initialise Razorpay with your key and theorder_id created in step 1.1. Provide a handler to receive the successful payment response (you can also use event listeners — see step 1.6).
JavaScript
Initialisation Parameters
Initialisation Parameters
1.4 Check Apple Pay Eligibility
UsecanMakePayment() to check whether the customer’s device can pay with Apple Pay. Razorpay’s SDK encapsulates the device capability check, so you do not integrate the Apple Pay JS API or evaluate paymentCredentialsAvailable yourself.
JavaScript
canMakePayment Parameters
canMakePayment Parameters
available: true when the customer can pay with Apple Pay and false otherwise. Only render an Apple Pay button when available is true.
Note on Eligibility
canMakePayment() returns true for customers who can complete an Apple Pay payment on their current device and browser. For international customers, this includes devices where Apple Pay is set up and devices where the customer can add a card during the flow. For domestic (India) customers, it returns true only where a usable Apple Pay credential is already present. You do not need to handle these cases yourself — render the button whenever available is true.1.5 Render the Button and Initiate Payment
Choose one of the following based on whether you want Razorpay to render the Apple Pay button or you render your own.1.6 Handle the Payment Response
Listen for payment lifecycle events, consistent with Custom Checkout. (You may also use thehandler function from step 1.3.)
JavaScript
Response
Response
canMakePayment() reasons, payment errors, client errors and a handling guide — see Error Responses.
1.7 Verify the Payment Signature
Verify the signature on your server before fulfilling the order.- Use the
order_idfrom your server (not therazorpay_order_idreturned by Checkout), therazorpay_payment_idfrom the response and yourkey_secret. - Construct an HMAC SHA256 hex digest:
JavaScript
- If the generated signature matches
razorpay_signature, the payment is authentic.
1.8 Verify Payment Status
Handy TipsOn the Razorpay Dashboard, ensure the payment status is captured. See capture settings to capture payments automatically.
Full Integration Example
JavaScript
Frequently Asked Questions
Do I need to integrate the Apple Pay JS API myself?
Do I need to integrate the Apple Pay JS API myself?
No.
canMakePayment() encapsulates the device capability check. You do not integrate the Apple Pay JS API or evaluate paymentCredentialsAvailable / paymentCredentialStatusUnknown yourself.Can the customer retry a failed payment?
Can the customer retry a failed payment?
Yes. On a retryable error (for example,
network_timeout), retry with the same order_id — no duplicate payment is created until the previous attempt resolves.Is it safe to create the order on the client side?
Is it safe to create the order on the client side?
No. Always create orders server-side using your secret key. Only the
order_id is passed to the frontend.