Swipez Docs
  • Billing software docs
  • Invoicing
  • Customer management
  • Payment gateway
    • Web integration
    • Payment API
  • Payouts
  • E-Invoice
  • Franchise
  • Webhooks
Powered by GitBook
On this page
  • Guidelines
  • Rate limiting
  • Quick Reference
  • Payment received
  • Payment status

Was this helpful?

  1. Payment gateway

Payment API

PreviousWeb integrationNextPayouts

Last updated 4 years ago

Was this helpful?

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 .

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 get list of payment transactions.

POST

To get status of payment.

Payment received

POST /api/v1/merchant/payment/received

This endpoint allows you to get list of payment transactions.

Request Body

Name
Type
Description

access_key_id

string

Your access key.

secret_access_key

string

Your secret key.

from_date

string

From date (in the format YYYY-mm-dd) from which you want the data.

to_date

string

To Date till you want the data

{
    "reqtime": "2021-03-02 16:44:10",
    "resptime": "2021-03-02 16:44:10",
    "srvrsp": [
        {
            "customer_name": "Rohit Sharma",
            "email": "rohit@swipez.in",
            "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": "virat@swipez.in",
            "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 --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"
}'

$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;

Payment status

POST /api/v1/merchant/payment/status

This endpoint allows you to get status of payment transaction.

Request Body

Name
Type
Description

access_key_id

string

Your access key.

secret_access_key

string

Your secret key.

transaction_type

string

Transaction type MERCHANT_TRANS_ID : Merchant reference no. SWIPEZ_TRANS_ID: Swipez transaction ID. SWIPEZ_REQ_ID: Swipez invoice id.

id

string

Value for transaction type

{
    "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": "rohit@swipez.in",
        "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 --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"
}'

$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;

AccessKey and SecretKey
/api/v1/merchant/payment/received
/api/v1/merchant/payment/status