API ReferenceIntegrationsKnowledge Base

Customers

You can create customers with basic details such as name and contact details and use them for various Razorpay solution offerings. Know more about customers.

Postman Collection๐Ÿ”—

We have a Postman collection to make the integration quicker and easier. Click the Download Postman Collection button below to get started.

Instructions to Use Postman Collection๐Ÿ”—

  • All Razorpay APIs are authenticated using Basic Authentication.

    • Generate API Keys from the Dashboard.
    • Add your API Keys in Postman. Select the required API โ†’ Auth โ†’ Type = Basic Auth โ†’ Username = [Your_Key_ID]; Password = [Your_Key_secret]
  • Some APIs in the collection require data specific to your account such as cust_id (Customer ID) as a path parameter.

    Example
    The Fetch Customer by ID API requires you to add the cust_id as a path parameter. Such parameters are enclosed in {} in the collection. For example, {cust_id}. The API throws an error if these are incorrect or do not exist in your system.

Customer Entity๐Ÿ”—

id
string Unique identifier of the customer. For example, cust_1Aa00000000004.
name
string Customer's name. Alphanumeric, with period (.), apostrophe (') and parentheses allowed. Name must be between 3-50 characters in length. For example, Gaurav Kumar.
contact
string The customer's phone number. Maximum length of 15 characters, inclusive of country code. For example, +919876543210.
email
string The customer's email address. 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. Timestamp, in Unix, when the customer was created. For example, 1234567890.

You can create and manage customer using APIs or from the Razorpay Dashboard.

Create a Customer๐Ÿ”—

Use the below endpoint to create a customer:

/customers

Request Parameters๐Ÿ”—

name mandatory
string Customer's name. Alphanumeric value with period (.), apostrophe (') and parentheses are allowed. Name must be between 3-50 characters in length. For example, Gaurav Kumar.
contact optional
string The customer's phone number. Maximum length of 15 characters including the country code. For example, +919876543210.
email optional
string The customer's email address. 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โ€.

Edit Customer Details๐Ÿ”—

Use the below endpoint to edit customer details:

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

Path Parameter๐Ÿ”—

id mandatory
string The unique identifier linked to the customer.

Fetch all Customers๐Ÿ”—

You can use the below endpoint to fetch all customers in your system:

/customers

Query Parameters๐Ÿ”—

count
integer The number of customers to be fetched. The default value is 10. The maximum value is 100. This can be used for pagination, in combination with skip.
skip
integer The number of customers to be skipped. The default value is 0. This can be used for pagination, in combination with count.

Fetch Customer by ID๐Ÿ”—

Use the below endpoint to fetch details of a customer by id:

/customers/:id

Path Parameter๐Ÿ”—

id mandatory
string The unique identifier linked to the customer.
×