Comment on page
E-Invoice
Learn more about payouts APIs and their usage.
Below are some of the points you must be aware of while calling Payouts 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.
Calling the Authentication APIs allows you to get and verify bearer tokens returned by Swipez. Swipez require these token for all further communication.
Swipez libraries automatically call the Authorize API and internally store the token. Do not store the token in an insecure manner. Regenerating a new token does not invalidate the already generated token. Token generated from one IP address cannot be used from a different IP address. Token generated is valid for 60 Min . Please ensure that you get a new token by calling the authorize API once the token has expired.
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.
post
/api/token
Get token
CURL
PHP
curl --location --request POST '<BASE URL>/api/token' \
--form 'access_key_id="<GET ACCESS KEY ID FROM YOUR ACCOUNT>"' \
--form 'secret_access_key="<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/token',
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 => array('access_key_id' => '<GET ACCESS KEY ID FROM YOUR ACCOUNT>','secret_access_key' => '<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>'),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/einvoice/save
Save E-invoice
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/einvoice/save' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"userGstin": "01AAACI9260R002",
"pobCode": null,
"supplyType": "O",
"ntr": "Inter",
"docType": "RI",
"catg": "B2B",
"dst": "O",
"trnTyp": "REG",
"no": "AG/03-09/4565",
"dt": "28-03-2021",
"refinum": null,
"refidt": null,
"pos": "27",
"diffprcnt": null,
"etin": null,
"rchrg": "N",
"sgstin": "01AAACI9260R002",
"strdNm": "TEST Company",
"slglNm": "TEST PROD",
"sbnm": "Testing",
"sflno": "ABC",
"sloc": "BANGALOR32",
"sdst": "BENGALURU",
"sstcd": "01",
"spin": "192233",
"sph": "123456111111",
"sem": "[email protected]",
"bgstin": "02AAACI9260R002",
"btrdNm": "TEST ENTERPRISES",
"blglNm": "TEST PRODUCT",
"bbnm": "ABCD12345",
"bflno": "abc",
"bloc": "Jijamat",
"bdst": "BANGALORE",
"bstcd": "02",
"bpin": "174001",
"bph": "989898111111",
"bem": "[email protected]",
"dgstin": null,
"dtrdNm": null,
"dlglNm": null,
"dbnm": null,
"dflno": null,
"dloc": null,
"ddst": null,
"dstcd": null,
"dpin": null,
"dph": null,
"dem": null,
"togstin": null,
"totrdNm": null,
"tolglNm": null,
"tobnm": null,
"toflno": null,
"toloc": null,
"todst": null,
"tostcd": null,
"topin": null,
"toph": null,
"toem": null,
"sbnum": null,
"sbdt": null,
"port": null,
"expduty": 1234,
"cntcd": null,
"forCur": null,
"invForCur": null,
"taxSch": "GST",
"totinvval": 4262.73,
"totdisc": 10,
"totfrt": null,
"totins": null,
"totpkg": null,
"totothchrg": 20,
"tottxval": 3322.45,
"totiamt": 930.28,
"totcamt": 0,
"totsamt": 0,
"totcsamt": 0,
"totstcsamt": 0,
"rndOffAmt": 0,
"sec7act": "N",
"invStDt": null,
"invEndDt": null,
"invRmk": null,
"omon": null,
"odty": null,
"oinvtyp": "B2CL",
"octin": null,
"userIRN": null,
"payNm": null,
"acctdet": null,
"pa":null,
"mode": null,
"ifsc": null,
"payTerm": null,
"payInstr": null,
"crTrn": null,
"dirDr": null,
"crDay": null,
"balAmt": null,
"paidAmt": null,
"payDueDt": null,
"transId": null,
"subSplyTyp": "Supply",
"subSplyDes": null,
"kdrefinum": null,
"kdrefidt": null,
"transMode": null,
"vehTyp": null,
"transDist": "",
"transName": null,
"transDocNo": null,
"transDocDate": null,
"vehNo": null,
"clmrfnd": null,
"rfndelg": null,
"boef": null,
"fy": null,
"refnum": null,
"pdt": null,
"ivst": null,
"cptycde": null,
"gen1": "abcd",
"gen2": "abcd",
"gen3": "abcd",
"gen4": "abcd",
"gen5": "abcd",
"gen6": "abcd",
"gen7": "abcd",
"gen8": "abcd",
"gen9": "abcd",
"gen10": "abcd",
"gen11": "abcd",
"gen12": "abcd",
"gen13": "abcd",
"gen14": "PJTCG001",
"gen15": "abcd",
"gen16": "abcd",
"gen17": "abcd",
"gen18": "abcd",
"gen19": "abcd",
"gen20": "abcd",
"gen21": "abcd",
"gen22": "abcd",
"gen23": "abcd",
"gen24": "abcd",
"gen25": "abcd",
"gen26": "abcd",
"gen27": "abcd",
"gen28": "abcd",
"gen29": "abcd",
"gen30": "abcd",
"pobewb": "Null",
"pobret": "Null",
"tcsrt": "null",
"tcsamt": 0,
"pretcs": 0,
"genIrn": true,
"genewb": "N",
"signedDataReq": true,
"itemList": [
{
"barcde": null,
"bchExpDt": null,
"bchWrDt": null,
"bchnm": null,
"camt": 0,
"cesNonAdval": 0,
"stCesNonAdvl": 0,
"crt": 0,
"csamt": 0,
"csrt": 0,
"disc": 0,
"freeQty": 0,
"hsnCd": "73041190",
"iamt": 930.28,
"irt": 28,
"isServc": null,
"itmgen1": null,
"itmgen2": null,
"itmgen3": null,
"itmgen4": null,
"itmgen5": null,
"itmgen6": null,
"itmgen7": null,
"itmgen8": null,
"itmgen9": null,
"itmgen10": null,
"itmVal": 4252.73,
"num": "00001",
"ordLineRef": null,
"orgCntry": null,
"othchrg": 0,
"prdDesc": null,
"prdNm": "SEAMLESS STEEL TUBE 10X2 -U71889903",
"prdSlNo": null,
"preTaxVal": 0,
"qty": 1,
"rt": 28,
"samt": 0,
"srt": 0,
"stcsamt": 0,
"stcsrt": 0,
"sval": 3322.45,
"txp": null,
"txval": 3322.45,
"unit": "NOS",
"unitPrice": 3322.451,
"invItmOtherDtls": [
{
"attNm": "aaa",
"attVal": "aaa"
},
{
"attNm": "xyz",
"attVal": "2300"
}
]
}
],
"invOthDocDtls": [
{
"url": "www.google.com",
"docs": "This is the url",
"infoDtls": "abcd"
}
],
"invRefPreDtls": [
{
"oinum": null,
"oidt": null,
"othRefNo": null
}
],
"invRefContDtls": [
{
"raref": null,
"radt": null,
"tendref": null,
"contref": null,
"extref": null,
"projref": null,
"poref": null,
"porefdt": null
}
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/einvoice/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 =>'{
"userGstin": "01AAACI9260R002",
"pobCode": null,
"supplyType": "O",
"ntr": "Inter",
"docType": "RI",
"catg": "B2B",
"dst": "O",
"trnTyp": "REG",
"no": "AG/03-09/4565",
"dt": "28-03-2021",
"refinum": null,
"refidt": null,
"pos": "27",
"diffprcnt": null,
"etin": null,
"rchrg": "N",
"sgstin": "01AAACI9260R002",
"strdNm": "TEST Company",
"slglNm": "TEST PROD",
"sbnm": "Testing",
"sflno": "ABC",
"sloc": "BANGALOR32",
"sdst": "BENGALURU",
"sstcd": "01",
"spin": "192233",
"sph": "123456111111",
"sem": "[email protected]",
"bgstin": "02AAACI9260R002",
"btrdNm": "TEST ENTERPRISES",
"blglNm": "TEST PRODUCT",
"bbnm": "ABCD12345",
"bflno": "abc",
"bloc": "Jijamat",
"bdst": "BANGALORE",
"bstcd": "02",
"bpin": "174001",
"bph": "989898111111",
"bem": "[email protected]",
"dgstin": null,
"dtrdNm": null,
"dlglNm": null,
"dbnm": null,
"dflno": null,
"dloc": null,
"ddst": null,
"dstcd": null,
"dpin": null,
"dph": null,
"dem": null,
"togstin": null,
"totrdNm": null,
"tolglNm": null,
"tobnm": null,
"toflno": null,
"toloc": null,
"todst": null,
"tostcd": null,
"topin": null,
"toph": null,
"toem": null,
"sbnum": null,
"sbdt": null,
"port": null,
"expduty": 1234,
"cntcd": null,
"forCur": null,
"invForCur": null,
"taxSch": "GST",
"totinvval": 4262.73,
"totdisc": 10,
"totfrt": null,
"totins": null,
"totpkg": null,
"totothchrg": 20,
"tottxval": 3322.45,
"totiamt": 930.28,
"totcamt": 0,
"totsamt": 0,
"totcsamt": 0,
"totstcsamt": 0,
"rndOffAmt": 0,
"sec7act": "N",
"invStDt": null,
"invEndDt": null,
"invRmk": null,
"omon": null,
"odty": null,
"oinvtyp": "B2CL",
"octin": null,
"userIRN": null,
"payNm": null,
"acctdet": null,
"pa":null,
"mode": null,
"ifsc": null,
"payTerm": null,
"payInstr": null,
"crTrn": null,
"dirDr": null,
"crDay": null,
"balAmt": null,
"paidAmt": null,
"payDueDt": null,
"transId": null,
"subSplyTyp": "Supply",
"subSplyDes": null,
"kdrefinum": null,
"kdrefidt": null,
"transMode": null,
"vehTyp": null,
"transDist": "",
"transName": null,
"transDocNo": null,
"transDocDate": null,
"vehNo": null,
"clmrfnd": null,
"rfndelg": null,
"boef": null,
"fy": null,
"refnum": null,
"pdt": null,
"ivst": null,
"cptycde": null,
"gen1": "abcd",
"gen2": "abcd",
"gen3": "abcd",
"gen4": "abcd",
"gen5": "abcd",
"gen6": "abcd",
"gen7": "abcd",
"gen8": "abcd",
"gen9": "abcd",
"gen10": "abcd",
"gen11": "abcd",
"gen12": "abcd",
"gen13": "abcd",
"gen14": "PJTCG001",
"gen15": "abcd",
"gen16": "abcd",
"gen17": "abcd",
"gen18": "abcd",
"gen19": "abcd",
"gen20": "abcd",
"gen21": "abcd",
"gen22": "abcd",
"gen23": "abcd",
"gen24": "abcd",
"gen25": "abcd",
"gen26": "abcd",
"gen27": "abcd",
"gen28": "abcd",
"gen29": "abcd",
"gen30": "abcd",
"pobewb": "Null",
"pobret": "Null",
"tcsrt": "null",
"tcsamt": 0,
"pretcs": 0,
"genIrn": true,
"genewb": "N",
"signedDataReq": true,
"itemList": [
{
"barcde": null,
"bchExpDt": null,
"bchWrDt": null,
"bchnm": null,
"camt": 0,
"cesNonAdval": 0,
"stCesNonAdvl": 0,
"crt": 0,
"csamt": 0,
"csrt": 0,
"disc": 0,
"freeQty": 0,
"hsnCd": "73041190",
"iamt": 930.28,
"irt": 28,
"isServc": null,
"itmgen1": null,
"itmgen2": null,
"itmgen3": null,
"itmgen4": null,
"itmgen5": null,
"itmgen6": null,
"itmgen7": null,
"itmgen8": null,
"itmgen9": null,
"itmgen10": null,
"itmVal": 4252.73,
"num": "00001",
"ordLineRef": null,
"orgCntry": null,
"othchrg": 0,
"prdDesc": null,
"prdNm": "SEAMLESS STEEL TUBE 10X2 -U71889903",
"prdSlNo": null,
"preTaxVal": 0,
"qty": 1,
"rt": 28,
"samt": 0,
"srt": 0,
"stcsamt": 0,
"stcsrt": 0,
"sval": 3322.45,
"txp": null,
"txval": 3322.45,
"unit": "NOS",
"unitPrice": 3322.451,
"invItmOtherDtls": [
{
"attNm": "aaa",
"attVal": "aaa"
},
{
"attNm": "xyz",
"attVal": "2300"
}
]
}
],
"invOthDocDtls": [
{
"url": "www.google.com",
"docs": "This is the url",
"infoDtls": "abcd"
}
],
"invRefPreDtls": [
{
"oinum": null,
"oidt": null,
"othRefNo": null
}
],
"invRefContDtls": [
{
"raref": null,
"radt": null,
"tendref": null,
"contref": null,
"extref": null,
"projref": null,
"poref": null,
"porefdt": null
}
]
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <TOKEN>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/einvoice/cancel
E-invoice cancel
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/einvoice/cancel' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"irn":"a287f526ec393d69a6202156d285e2e508902dedda1ed3daeadda8a5c2696a6d",
"cnlRsn":"1",
"cnlRem":"Wrong entry",
"userGstin":"01AAACI9260R002"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/einvoice/cancel',
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 =>'{
"irn":"a287f526ec393d69a6202156d285e2e508902dedda1ed3daeadda8a5c2696a6d",
"cnlRsn":"1",
"cnlRem":"Wrong entry",
"userGstin":"01AAACI9260R002"
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <TOKEN>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/einvoice/list
E-invoice list
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/einvoice/list' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"gstin": "01AAACI9260R002",
"docNo": [
"12369"
],
"fromDt": "19/02/2020",
"toDt": "19/02/2020",
"btrdNm": "Aamir Traders",
"catg": [
"B2B"
],
"docType": [
"RI"
],
"invStatus": [
"UPLOADED",
"IRN_GENERATED"
],
"irnStatus": [
"ACT",
"CAN"
],
"totinvval": {
"gt": "8000"
},
"itemCount": {
"gt": "0"
},
"hasError": false,
"hasWarning": true,
"page": 0,
"size": 50
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/einvoice/list',
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 =>'{
"gstin": "01AAACI9260R002",
"docNo": [
"12369"
],
"fromDt": "19/02/2020",
"toDt": "19/02/2020",
"btrdNm": "Aamir Traders",
"catg": [
"B2B"
],
"docType": [
"RI"
],
"invStatus": [
"UPLOADED",
"IRN_GENERATED"
],
"irnStatus": [
"ACT",
"CAN"
],
"totinvval": {
"gt": "8000"
},
"itemCount": {
"gt": "0"
},
"hasError": false,
"hasWarning": true,
"page": 0,
"size": 50
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <TOKEN>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
get
/api/v1/einvoice/details
Get invoice details
CURL
PHP
curl --location --request GET '<BASE URL>/api/v1/einvoice/details?einvId=2133' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/einvoice/details?einvId=2133',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <TOKEN>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last modified 1yr ago