Customers

Create, edit, and fetch Customer details using Razorpay APIs.


Add or create

with basic details such as name, email and contact details. You can then offer various Razorpay solutions to your customers. Edit customer details as needed.

You can try out our APIs on the Razorpay Postman Public Workspace.

The Customer entity has the following fields:

id

string Unique identifier of the customer. For example, cust_1Aa00000000004.

name

string Customer's name. Alphanumeric, with period (.), apostrophe (') and parentheses allowed. The name must be between 3-50 characters in length. For example, Gaurav Kumar.

contact

string The customer's phone number. A maximum length of 15 characters including country code. For example, +919876543210.

email

string The customer's email address. A maximum length of 64 characters. For example, gaurav.kumar@example.com.

gstin

string GST number linked to the customer. For example, 29XAbbA4369J1PA.

notes

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”.

created_at

integer UNIX timestamp, when the customer was created. For example, 1234567890.

You can create and manage customers using APIs or from the

.

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.

POST
/customers

name

optional

string Customer's name. Alphanumeric value with period (.), apostrophe (') 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:

  • 0: If a customer with the same details already exists, fetches details of the existing customer.
  • 1 (default): If a customer with the same details already exists, throws an error.

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”.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while creating an order.

ErrorCauseSolution
The API <key/secret> provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.
  • Different keys for test mode and live modes.
  • Expired API key.
The API keys must be active and entered correctly with no whitespace before or after the keys.
Contact number should be at least 8 digits, including country codeThe contact number is less than 8 digits.Enter contact number that meets the validation criteria. It should have at least 8 digits, including the country code. For example, "+919876543210".

The following endpoint edits the customer details such as name, email and contact details.

PUT
/customers/:id

Handy Tips

When editing a customer's details, ensure that the combination of the values in the email and contact attributes is unique for a customer.

id

mandatory

string The unique identifier linked to the customer.

name

optional

string Customer's name. Alphanumeric, with period (.), apostrophe (') and parentheses 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. For example, +919876543210.

email

optional

string The customer's email address. A maximum length of 64 characters. For example, gaurav.kumar@example.com.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while editing a customer.

ErrorCauseSolution
The API <key/secret> provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.
  • Different keys for test mode and live modes.
  • Expired API key.
The API keys must be active and entered correctly with no whitespace before or after the keys.
Contact number should be at least 8 digits, including country codeThe contact number is less than 8 digits.Enter contact number that meets the validation criteria. It should have at least 8 digits, including the country code. For example, "+919876543210".
id is not a valid idThe customer_id passed is invalid.Use a valid customer_id .

The following endpoint retrieves the details of all the customers.

GET
/customers

count

optional

integer The number of customer records to be retrieved from the system. The default value is 10. The maximum value is 100. This can be used for pagination in combination with skip.

skip

optional

integer The number of customer records that must be skipped. The default value is 0. This can be used for pagination in combination with count.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while fetching orders.

ErrorCauseSolution
The API <key/secret> provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.
  • Different keys for test mode and live modes.
  • Expired API key.
The API keys must be active and entered correctly with no whitespace before or after the keys.

The following endpoint retrieves details of a customer as per the ID.

GET
/customers/:id

id

mandatory

string The unique identifier linked to the customer.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while fetching an order with Order id.

ErrorCauseSolution
The API <key/secret> provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.
  • Different keys for test mode and live modes.
  • Expired API key.
The API keys must be active and entered correctly with no whitespace before or after the keys.
id is not a valid idThe customer_id passed is invalid.Use a valid customer_id .
The id provided does not existThe customer_id does not exist or does not belong to the requestor.Ensure that you use a valid customer_id that belongs to the requestor.

Was this page helpful?