Swipez Docs
Search
K
Comment on page

Customer management

Learn more about customer management APIs and their usage.

Guidelines

Below are some of the points you must be aware of while calling Swipez APIs:‌
  • All API responses are in JSON format.
  • POST requests should include ContentType: application/json
  • All API response have status, message, and data.
  • Swipez uses API keys to allow access to the API. Once you have signed up at our merchant site, you will be able to see your AccessKey and SecretKey.

Rate limiting

The API is rate limited per user. You will receive a 429 HTTP status code if you exceed the rate limit. The rate limit is 30 requests per minute per user and is subject to change.

Quick Reference

URL
HTTP Verb
Functionality
POST
To create customers.
POST
To update created customer.
POST
To get customer details.
POST
To get customer list.
post
/api/v1/merchant/customer/save
Create customer

Sample code

CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/merchant/customer/save' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"customer": [
{
"customer_code": "Cust-254",
"customer_name": "Rohit Sharma",
"email": "[email protected]",
"mobile": "9999999999",
"address": "Behala Manton Super Market, Room 43, Behala",
"city": "Kolkata",
"state": " West Bengal",
"zipcode": "700034",
"custom_fields": [
{
"id": "4839",
"name": "Customer GSTN",
"type": "gst",
"value": "33BRSPP2039T1ZU"
},
{
"id": "4840",
"name": "Company Name",
"type": "company_name",
"value": "Swipez"
}
]
}
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/customer/save',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"customer": [
{
"customer_code": "Cust-254",
"customer_name": "Rohit Sharma",
"email": "[email protected]",
"mobile": "9999999999",
"address": "Behala Manton Super Market, Room 43, Behala",
"city": "Kolkata",
"state": "West Bengal",
"zipcode": "700034",
"custom_fields": [
{
"id": "4839",
"name": "Customer GSTN",
"type": "gst",
"value": "33BRSPP2039T1ZU"
}
]
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Cookie: __cfduid=d4b581ca97b6435b558bd41f9610f82b51614605091; PHPSESSID=h0md9koeohb4t9tpseem501oua'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/merchant/customer/update
Update customer

Sample code

CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/merchant/customer/update' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"customer": [
{
"customer_id": "125484",
"customer_code": "Cust-254",
"customer_name": "Rohit Sharma",
"email": "[email protected]",
"mobile": "9999999999",
"address": "Behala Manton Super Market, Room 43, Behala",
"city": "Kolkata",
"state": " West Bengal",
"zipcode": "700034",
"custom_fields": [
{
"id": "4839",
"name": "Customer GSTN",
"type": "gst",
"value": "33BRSPP2039T1ZU"
},
{
"id": "4840",
"name": "Company Name",
"type": "company_name",
"value": "Swipez"
}
]
}
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/customer/update',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"customer": [
{
"customer_id": "125484",
"customer_code": "Cust-254",
"customer_name": "Rohit Sharma",
"email": "[email protected]",
"mobile": "9999999999",
"address": "Behala Manton Super Market, Room 43, Behala",
"city": "Kolkata",
"state": "West Bengal",
"zipcode": "700034",
"custom_fields": [
{
"id": "4839",
"name": "Customer GSTN",
"type": "gst",
"value": "33BRSPP2039T1ZU"
}
]
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Cookie: __cfduid=d4b581ca97b6435b558bd41f9610f82b51614605091; PHPSESSID=h0md9koeohb4t9tpseem501oua'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/merchant/customer/getlist
Customer list

Sample code

CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/merchant/customer/getlist' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"searchby": "state",
"keyword": "maharashtra"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/customer/getlist',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"searchby": "state",
"keyword": "maharashtra"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/merchant/customer/detail
Customer detail

Sample code

CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/merchant/customer/detail' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"customer_code": "cust-1"
"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/customer/detail',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"customer_code": "cust-1"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;