Comment on page
Invoicing
Learn more about invoicing APIs and their usage.
Below are some of the points you must be aware of while calling Swipez APIs:
- All API requests and 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.
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.
URL | HTTP Verb | Functionality |
POST | To create invoice. | |
POST | To update created invoice. | |
POST | To settle invoice. | |
POST | To get invoice details. | |
POST | To get invoice list. | |
POST | To save recurring invoice. | |
POST | To delete or cancel invoice |
post
/api/v3/merchant/invoice/save
Save invoice
CURL
PHP
curl --location --request POST '<BASE URL>/api/v3/merchant/invoice/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>",
"template_id": "<GET TEMPLATE ID FROM YOUR ACCOUNT>",
"invoice": [
{
"customer_code": "Cust-1",
"bill_cycle_name": "Feb 21",
"bill_date": "2021-02-01",
"due_date": "2021-02-05",
"invoice_properties": {
"notify_patron": "1"
},
"custom_header_fields": [
{
"id": "1853191",
"name": "Invoice no",
"type": "text",
"value": "INV-5"
}
],
"particular_rows": [
{
"item": "Product name",
"sac_code": "9899",
"description": "Product description",
"gst": "18",
"total_amount": "1500.00"
}
],
"tax_rows": [
{
"name": "IGST@18%",
"percentage": "18.00",
"applicable_on": "1500.00"
}
],
"new_customer": {
"customer_code": "",
"customer_name": "",
"email": "",
"mobile": "",
"address": "",
"city": "",
"state": "",
"zipcode": "",
"custom_fields": [
{
"id": "845",
"name": "GST",
"type": "gst",
"value": ""
}
]
},
"settlement": {
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"invoice_id": "",
"paid_date": "2022-02-23",
"amount": "18.00",
"mode": "Online",
"bank_name": "",
"bank_ref_no": "1234567",
"cheque_no": "",
"cash_paid_to": "",
"notify": "1",
"attach_invoice_pdf": "1"
}
}
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v3/merchant/invoice/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>",
"template_id": "<GET TEMPLATE ID FROM YOUR ACCOUNT>",
"invoice": [
{
"customer_code": "Cust-1",
"bill_cycle_name": "Feb 21",
"bill_date": "2021-02-01",
"due_date": "2021-02-05",
"invoice_properties": {
"notify_patron": "1"
},
"custom_header_fields": [
{
"id": "1853191",
"name": "Invoice no",
"type": "text",
"value": "INV-5"
}
],
"particular_rows": [
{
"item": "Product name",
"sac_code": "9899",
"description": "Product description",
"gst": "18",
"total_amount": "1500.00"
}
],
"tax_rows": [
{
"name": "IGST@18%",
"percentage": "18.00",
"applicable_on": "1500.00"
}
],
"new_customer": {
"customer_code": "",
"customer_name": "",
"email": "",
"mobile": "",
"address": "",
"city": "",
"state": "",
"zipcode": "",
"custom_fields": [
{
"id": "845",
"name": "GST",
"type": "gst",
"value": ""
},
{
"id": "846",
"name": "Company Name",
"type": "company_name",
"value": ""
}
]
},
"settlement": {
"access_key_id": "<GET ACCESS KEY ID FROM YOUR ACCOUNT>",
"secret_access_key": "<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>",
"invoice_id": "",
"paid_date": "2022-02-23",
"amount": "18.00",
"mode": "Online",
"bank_name": "",
"bank_ref_no": "1234567",
"cheque_no": "",
"cash_paid_to": "",
"notify": "1",
"attach_invoice_pdf": "1"
}
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v3/merchant/invoice/update
Update invoice
CURL
PHP
curl --location --request POST '<BASE URL>/api/v3/merchant/invoice/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>",
"invoice_id": "<SYSTEM GENERATED INVOICE ID>",
"invoice":
{
"customer_code": "Cust-1",
"bill_cycle_name": "Feb 21",
"bill_date": "2021-02-01",
"due_date": "2021-02-05",
"invoice_properties": {
"notify_patron": "1"
},
"custom_header_fields": [
{
"id": "1853191",
"name": "Invoice no",
"type": "text",
"value": "INV-5"
}
],
"particular_rows": [
{
"item": "Product name",
"sac_code": "9899",
"description": "Product description",
"gst": "18",
"total_amount": "1500.00"
}
],
"tax_rows": [
{
"name": "IGST@18%",
"percentage": "18.00",
"applicable_on": "1500.00"
}
],
"new_customer": {
"customer_code": "",
"customer_name": "",
"email": "",
"mobile": "",
"address": "",
"city": "",
"state": "",
"zipcode": "",
"custom_fields": [
{
"id": "845",
"name": "GST",
"type": "gst",
"value": ""
},
{
"id": "846",
"name": "Company Name",
"type": "company_name",
"value": ""
}
]
}
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v3/merchant/invoice/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>",
"invoice_id": "<SYSTEM GENERATED INVOICE ID>",
"invoice":
{
"customer_code": "Cust-1",
"bill_cycle_name": "Feb 21",
"bill_date": "2021-02-01",
"due_date": "2021-02-05",
"invoice_properties": {
"notify_patron": "1"
},
"custom_header_fields": [
{
"id": "1853191",
"name": "Invoice no",
"type": "text",
"value": "INV-5"
}
],
"particular_rows": [
{
"item": "Product name",
"sac_code": "9899",
"description": "Product description",
"gst": "18",
"total_amount": "1500.00"
}
],
"tax_rows": [
{
"name": "IGST@18%",
"percentage": "18.00",
"applicable_on": "1500.00"
}
],
"new_customer": {
"customer_code": "",
"customer_name": "",
"email": "",
"mobile": "",
"address": "",
"city": "",
"state": "",
"zipcode": "",
"custom_fields": [
{
"id": "845",
"name": "GST",
"type": "gst",
"value": ""
}
]
}
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v2/merchant/invoice/settle
Settle invoice
CURL
PHP
curl --location --request POST '<BASE URL>/api/v2/merchant/invoice/settle' \
--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>",
"invoice_id": "<SYSTEM GENERATED INVOICE ID>",
"paid_date": "2021-03-01",
"amount": "500.00",
"mode": "Online",
"bank_name": "",
"bank_ref_no": "8749540",
"cheque_no": "",
"cash_paid_to": "",
"notify": "1"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v2/merchant/invoice/settle',
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>",
"invoice_id": "<SYSTEM GENERATED INVOICE ID>",
"paid_date": "2021-03-01",
"amount": "500.00",
"mode": "Online",
"bank_name": "",
"bank_ref_no": "8749540",
"cheque_no": "",
"cash_paid_to": "",
"notify": "0"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/merchant/invoice/detail
Get invoice details
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/merchant/invoice/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>",
"invoice_id": "<SYSTEM GENERATED INVOICE ID>"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/invoice/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>",
"invoice_id": "<SYSTEM GENERATED INVOICE ID>"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/merchant/invoice/getlist
Invoice list
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/merchant/invoice/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>",
"from_date": "2021-02-04",
"to_date": "2021-03-03",
"filter_by": "bill_date",
"invoice_status": "",
"customer_code": "",
"group": "",
"franchise_id": ""
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/invoice/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>",
"from_date": "2021-02-04",
"to_date": "2021-03-03",
"filter_by": "bill_date",
"invoice_status": "",
"customer_code": "",
"group": "",
"franchise_id": ""
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/merchant/subscription/save
Save subscription
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/merchant/subscription/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>",
"template_id": "<GET TEMPLATE ID FROM YOUR ACCOUNT>",
"mode": "Monthly",
"repeat_every": "3",
"start_date": "2021-03-01",
"due_date": "2021-03-07",
"end_mode": "Never",
"occurences": "",
"end_date": "",
"carry_forword_dues": "0",
"invoice":
{
"customer_code": "Cust-1",
"bill_cycle_name": "Feb 21",
"bill_date": "2021-02-01",
"due_date": "2021-02-05",
"invoice_properties": {
"notify_patron": "1"
},
"custom_header_fields": [
{
"id": "1853191",
"name": "Invoice no",
"type": "text",
"value": "INV-5"
}
],
"particular_rows": [
{
"item": "Product name",
"sac_code": "9899",
"description": "Product description",
"gst": "18",
"total_amount": "1500.00"
}
],
"tax_rows": [
{
"name": "IGST@18%",
"percentage": "18.00",
"applicable_on": "1500.00"
}
],
"new_customer": {
"customer_code": "",
"customer_name": "",
"email": "",
"mobile": "",
"address": "",
"city": "",
"state": "",
"zipcode": "",
"custom_fields": [
{
"id": "845",
"name": "GST",
"type": "gst",
"value": ""
}
]
}
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/merchant/subscription/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>",
"template_id": "<GET TEMPLATE ID FROM YOUR ACCOUNT>",
"mode": "Monthly",
"repeat_every": "3",
"start_date": "2021-03-01",
"due_date": "2021-03-07",
"end_mode": "Never",
"occurences": "",
"end_date": "",
"carry_forword_dues": "0",
"invoice":
{
"customer_code": "Cust-1",
"bill_cycle_name": "Feb 21",
"bill_date": "2021-02-01",
"due_date": "2021-02-05",
"invoice_properties": {
"notify_patron": "1"
},
"custom_header_fields": [
{
"id": "1853191",
"name": "Invoice no",
"type": "text",
"value": "INV-5"
}
],
"particular_rows": [
{
"item": "Product name",
"sac_code": "9899",
"description": "Product description",
"gst": "18",
"total_amount": "1500.00"
}
],
"tax_rows": [
{
"name": "IGST@18%",
"percentage": "18.00",
"applicable_on": "1500.00"
}
],
"new_customer": {
"customer_code": "",
"customer_name": "",
"email": "",
"mobile": "",
"address": "",
"city": "",
"state": "",
"zipcode": "",
"custom_fields": [
{
"id": "845",
"name": "GST",
"type": "gst",
"value": ""
}
]
}
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v3/merchant/invoice/deleteInvoice
Delete invoice
Sample Code
CURL
PHP
curl --location --request POST '<BASE URL>/api/v3/merchant/invoice/deleteInvoice' \
--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>",
"invoice_id": "<SYSTEM GENERATED INVOICE ID>",
"status": "12" //12 cancelled, 13 deleteted
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v3/merchant/invoice/deleteInvoice',
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>",
"invoice_id": "<SYSTEM GENERATED INVOICE ID>",
"status": "12" //12 cancelled, 13 deleteted
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last modified 1yr ago