Prerequisites
- Create a Razorpay account.
- Generate API Keys on Dashboard. Watch this video to know how to generate Test Mode API keys. Watch this video to know how to generate Live Mode API keys.
- Integrate with our Standard Checkout.
- Generate API Keys on Dashboard.
- Integrate with our Standard Checkout.
Step 1: Enable Flash Checkout on Dashboard
Flash Checkout, enabled by default on your Standard Checkout, lets your customers save their card details for future purchases. Customers can choose whether to save their card information during the payment process. All card details are stored securely using PCI-DSS-compliant technology. Know more about Flash Checkout.Step 2: Create a Customer
Create a customer whose card details should be saved from the Dashboard or using the Customers API. You can create customers with basic details such asemail and contact using the following endpoint:
API Sample Code
The following endpoint creates or add a customer with basic details such as name and contact details. You can use this API for various Razorpay Solution offerings. /customersCurl
Success Response
Request Parameters
name optional
: string Customer’s name. Alphanumeric value with period (.), apostrophe (’), forward slash (/), at (@) and parentheses are allowed. The name must be between 3-50 characters in length. For example, Gaurav Kumar.
contact optional
: string The customer’s phone number. A maximum length of 15 characters including country code. For example, +919876543210.
email optional
: string The customer’s email address. A maximum length of 64 characters. For example, gaurav.kumar@example.com.
fail_existing optional
: string Possible values:
1(default): If a customer with the same details already exists, throws an error.0: If a customer with the same details already exists, fetches details of the existing customer.
gstin optional
: string Customer’s GST number, if available. For example, 29XAbbA4369J1PA.
notes optional
: object This is a key-value pair that can be used to store additional information about the entity. It can hold a maximum of 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.
Step 3: Create an Order
Order is an important step in the payment process.- An order should be created for every payment.
- You can create an order using the Orders API. It is a server-side API call. Know how to authenticate Orders API.
- The order_id received in the response should be passed to the checkout. This ties the Order with the payment and secures the request from being tampered.
Handy TipsRazorpay has added support for zero decimal currencies, such as JPY and three decimal currencies, such as KWD, BHD and OMR, allowing businesses to accept international payments in these currencies. Know more about Currency Conversion (May 2024).
receipt optional
: string Your receipt id for this order should be passed here. Maximum length is 40 characters.notes optional
: json object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.partial_payment optional
: boolean Indicates whether the customer can make a partial payment. Possible values:true: The customer can make partial payments.false(default): The customer cannot make partial payments.
id mandatory
: string Unique identifier of the customer. For example, cust_1Aa00000000004.Know more about Orders API.Response Parameters
Descriptions for the response parameters are present in the Orders Entity table.Error Response Parameters
The error response parameters are available in the API Reference Guide.Step 4: Enable Customer Card Saving on Checkout
While making the payment, the customer enters card details and can choose to save them for future use. Passcustomer_id along with the other parameters into the Checkout form.
Web Standard Checkout
Request Parameter
customer_id mandatory
: string Unique identifier of the customer. This can be obtained from the response of the previous step.
Know more about Checkout parameters for web integration.
To enable customers to save their cards, pass customer_id along with other parameters:
Save Card
Request Parameter
customer_id mandatory
: string Unique identifier of the customer. This can be obtained from the response of the previous step.
Know more about Checkout parameters for Android integration.
To enable customers to save their cards, pass customer_id along with other parameters. The options dictionary in Swift and Objective C are shown below:
Swift
Request Parameter
customer_id mandatory
: string Unique identifier of the customer. This can be obtained from the response of the previous step.
Know more about other Checkout parameters for iOS integration.
Step 5: Create Payments Using Saved Card
Once the card is saved, customers can complete payments on repeat purchases by only entering the CVV. To fetch saved cards, pass thecustomer_id to the Checkout form.
Initiate payment by passing customer_id to Checkout along with the other options.
Standard Checkout
Request Parameter
customer_id mandatory
: string Unique identifier of the customer. Created in Step 2.
Initiate payment by passing customer_id to Checkout along with the other options.
Initiate Payment
Request Parameter
customer_id mandatory
: string Unique identifier of the customer. Created in Step 2.
Initiate payment by passing customer_id to Checkout along with the other options.
Swift
Request Parameter
customer_id mandatory
: string Unique identifier of the customer. Created in Step 2.