Overview of the Customer APIs

A new Customer Object can be created whenever someone registers in your website or App. JusPay will respond with a new  customer_id that may be used when processing any future orders/payments from a customer. Merchant may also have the option of using the  object_reference_id instead that represents the customer in the merchant's database.

These three APIs handle customer data on the Juspay server.

Create Customer:   
Creates a new Customer Object with given Customer Data  (see table below).   New customer_id is generated.
Required:  x-merchantid, object_reference_id,
Customer Data parameters
Optional:   get_client_auth_token
Returns:   Customer Object  with new customer_id
  POST    https://api.juspay.in/customers
Get Customer:   
This will return the Customer Object for the given identifier.
Required:  customer_id, x-merchantid
Optional:   get_client_auth_token
Returns:   Customer Object
  GET       https://api.juspay.in/customers/:customer_id
Update Customer:   
This will update the identified Customer Object with given Customer Data parameters  (see table below)
Required:  customer_id, Customer Data parameter(s)
Returns:   Customer Object
  POST       https://api.juspay.in/customers/:customer_id
URL Embedded (Path) Parameter:

Field * Type Description
customer_id * String Use the Customer ID generated by Juspay or object reference ID given by merchant during customer creation.
* = Required only for the Get Customer and Update Customer APIs
Header:

Field * Type Description
x-merchantid * String The Merchant ID that a merchant holds at Juspay.
* = Required only for the Create customer and Get customer APIs
Request (Form) Parameters:

Field Type * Description
object_reference_id String *





Required only for the Create Customer API.
- Unique ID that you use to represent the customer in your database. This must be at least 8 characters and must be unique. The typical value for this field would be email address or mobile number or auto increment ID that you have in your DB.
options. get_client_auth_token  Object
Boolean
Optional only for the Create Customer API.
- This is required to obtain the  client_auth_token which is used for SDK integration
* = Required only for the specified API.
URL Embedded (Query) Parameter:

Field Type * Description
options. get_client_auth_token Boolean Optional only for the Get Customer API
- This is used to get the  client_auth_token which is required for SDK integration
Customer Data

Additional Request (Form) Parameters for the Create customer and Update customer APIs.

Field * Type Description
mobile_number * String Customer’s mobile number.w
email_address * String Customer’s e-mail address.
first_name String Customer’s first name.
last_name String Customer’s last name.
mobile_country_code String Mobile country code.
* = Required only for the Create Customer API

Response for Customer APIs - Customer Object

All Customer APIs return a response as a Customer Object:

Field Type Description
customer_id String Customer ID generated by JUSPAY.
object String Object type of entity, in this case it’ll be customer.
object_reference_id String Customer ID defined by you.
mobile_number String Customer’s mobile number.
date_created String Date creation of customer entity.
last_udpated String Last updated date of customer entity.
email_address String Customer’s e-mail address.
first_name String Customer’s first name.
last_name String Customer’s last name.
mobile_country_code String Mobile country code.
juspay:w{wwwwwwwwwwwn
   client_auth_token,
   client_auth_token_expiry}
Object
 String
 String
Object containing two client_auth_token parameters
Token required for SDK integration
Expiration date of  client_auth_token
Note 1:
A "customer_id" should be returned, not "id", as shown in the main document.
Note 2:
A Juspay Object (client_auth_token parameters) is included in the Customer Object responses for the Create and Get Customer APIs only if  options.get_client_auth_token is set to true in the request .