Payment API

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

/api/v1/merchant/payment/received

POST

To get list of payment transactions.

/api/v1/merchant/payment/status

POST

To get status of payment.

post
Payment received

/api/v1/merchant/payment/received
This endpoint allows you to get list of payment transactions.
Request
Response
Request
Body Parameters
access_key_id
required
string
Your access key.
secret_access_key
required
string
Your secret key.
from_date
required
string
From date (in the format YYYY-mm-dd) from which you want the data.
to_date
required
string
To Date till you want the data
Response
200: OK
{
"reqtime": "2021-03-02 16:44:10",
"resptime": "2021-03-02 16:44:10",
"srvrsp": [
{
"customer_name": "Rohit Sharma",
"email": "[email protected]",
"code": "cust-1",
"transaction_id": "T000002546",
"invoice_id": "R000029134",
"amount": "472.00",
"late_fee": "0.00",
"paid_date": "2021-02-05 11:12:12",
"payment_mode": "Online Payment"
},
{
"customer_name": "Virat Kohli",
"email": "[email protected]",
"code": "cust-2",
"transaction_id": "T000002548",
"invoice_id": "R000029146",
"amount": "472.00",
"late_fee": "0.00",
"paid_date": "2021-02-15 16:35:01",
"payment_mode": "Online Payment"
}
],
"errcode": null,
"errmsg": "",
"errlist": null
}

Sample code

CURL
PHP
CURL
curl --location --request POST '<BASE URL>/api/v1/merchant/payment/received' \
--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>",
"from_date": "2021-02-04",
"to_date": "2021-03-03"
}'
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/payment/received',
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>",
"from_date": "2021-02-04",
"to_date": "2021-03-03",
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

post
Payment status

/api/v1/merchant/payment/status
This endpoint allows you to get status of payment transaction.
Request
Response
Request
Body Parameters
access_key_id
required
string
Your access key.
secret_access_key
required
string
Your secret key.
transaction_type
required
string
Transaction type MERCHANT_TRANS_ID : Merchant reference no. SWIPEZ_TRANS_ID: Swipez transaction ID. SWIPEZ_REQ_ID: Swipez invoice id.
id
required
string
Value for transaction type
Response
200: OK
To get payment transaction status.
{
"reqtime": "2021-03-02 17:03:05",
"resptime": "2021-03-02 17:03:05",
"srvrsp": {
"transaction_id": "X000087677",
"reference_no": "1694SZ",
"status": "success",
"date": "2021-01-21 18:44:23",
"bank_ref_no": "8548787",
"mode": "NET_BANKING",
"amount": "1000.00",
"billing_name": "Rohit Sharma",
"billing_email": "[email protected]",
"billing_mobile": "9999999999",
"billing_address": "Behala Manton Super Market, Room 43, Behala",
"billing_city": "Kolkata",
"billing_state": "West Bengal",
"billing_postal_code": "84587",
"udf1": "",
"udf2": "",
"udf3": "",
"udf4": "",
"udf5": ""
},
"errcode": null,
"errmsg": "",
"errlist": null
}

Sample code

CURL
PHP
CURL
curl --location --request POST '<BASE URL>/api/v1/merchant/payment/status' \
--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>",
"transaction_type": "SWIPEZ_TRANS_ID",
"id": "X000028783"
}'
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/payment/status',
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>",
"transaction_type": "SWIPEZ_TRANS_ID",
"id": "X000028783"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;