Sample Code for Generate IRN
Type
|
Url
|
Headers
|
SandBox
|
https://gstsandbox.charteredinfo.com/eicore/dec/v1.03/Invoice?QrCodeSize=250
|
1. aspid
2. password
3. Gstin
4. user_name
5. AuthToken
6. [ParseIrnResp=0]
|
Production
|
https://einvapi.charteredinfo.com/eicore/dec/v1.03/Invoice?QrCodeSize=250
|
1. aspid
2. password
3. Gstin
4. user_name
5. AuthToken
6. [ParseIrnResp=0]
|
Generate IRN Code
RestClient client = new RestClient("https://gstsandbox.charteredinfo.com/eicore/dec/v1.03/Invoice?QrCodeSize=250");
RestRequest request = new RestRequest(Method.POST);
request.AddHeader("Gstin", "<---->");
request.AddHeader("user_name", "<---->");
request.AddHeader("AuthToken", "<----->");
request.AddHeader("aspid", "<------>");
request.AddHeader("password", "<------>");
request.AddHeader("Content-Type", "application/json; charset=utf-8");
request.RequestFormat = DataFormat.Json;
request.AddBody(reqPlGenIRN); //Request Payload in object format
IRestResponse response = await client.ExecuteTaskAsync(request);
RespPlGenIRNDec respPlGenIRN = new RespPlGenIRNDec();
respPlGenIRN = JsonConvert.DeserializeObject<RespPlGenIRNDec>(response.Content);
//code to save QR image
byte[] qrImg = Convert.FromBase64String(respPlGenIRN.QrCodeImage);
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap));
Bitmap bitmap1 = (Bitmap)tc.ConvertFrom(qrImg);
bitmap1.Save(@"C:\Users\Pallavi\Desktop\qr.png");
NOTE: If you wat just NIC Response and not using the Parsed Response that TaxPro GSP Returns in fields ExtractedSignedInvoiceData, ExtractedSignedQRCode, and QrCodeImage, please use query parm ParseIrnResp=0. This would prevent parsing of response and speed-up the API Response.
Success Responce
{
"Status": "1",
"Data": "{"AckNo":"88100002254","AckDt":"2020-03-11 17:13:00","Irn":"716a970b33ee7be98b493d478650dc9af12424b9712e4e070547864fa065644e",
"SignedInvoice":"<JWT Encoaded signed invoice data>",
"SignedQRCode":"<JWT Encoaded QR Code data>",
"Status":"ACT",
"EwbNo":"0",
"EwbDt":null,
"EwbValidTill":null,
"ExtractedSignedInvoiceData":{"AckNo":88100002254,"AckDt":"2020-03-11 17:13:00","Version":"1.01","Irn":"716a970b33ee7be98b493d478650dc9af12424b9712e4e070547864fa065644e","TranDtls":{"TaxSch":"GST","SupTyp":"B2B","RegRev":null,"EcmGstin":null},"DocDtls":{"Typ":"INV","No":"DOC-NO/51AS","Dt":"11/03/2020"},"SellerDtls":{"Gstin":"17AACCC1596Q002","LglNm":"ABC company pvt ltd","TrdNm":null,"Addr1":"5th block, kuvempu layout","Addr2":null,"Loc":"GANDHINAGAR","Pin":"560002","State":"KARNATAKA","Ph":null,"Em":null},"BuyerDtls":{"Gstin":"37BZNPM9430M1kl","LglNm":"XYZ company pvt ltd","TrdNm":null,"Pos":"37","Addr1":"7th block, kuvempu layout","Addr2":null,"Loc":"GANDHINAGAR","Pin":null,"State":null,"Ph":null,"Em":null},"DispDtls":{"Nm":"ABC company pvt ltd","Addr1":"7th block, kuvempu layout","Addr2":null,"Loc":"Banagalore","Pin":"560043","Stcd":"29"},"ShipDtls":{"Gstin":null,"LglNm":"CBE company pvt ltd","TrdNm":null,"Addr1":"7th block, kuvempu layout","Addr2":null,"Loc":"Banagalore","Pin":"560043","Stcd":"29"},"ValDtls":{"AssVal":0.0,"CgstVal":null,"SgstVal":null,"IgstVal":null,"CesVal":null,"StCesVal":null,"RndOffAmt":null,"TotInvVal":0.0,"TotInvValFc":null},"PayDtls":null,"ExpDtls":null,"RefDtls":null,"ItemList":[{"SlNo":"1","PrdDesc":null,"IsServc":"N","HsnCd":"1001","BchDtls":null,"Barcde":null,"Qty":null,"FreeQty":null,"Unit":null,"UnitPrice":10.0,"TotAmt":10.0,"Discount":0.0,"PreTaxVal":0.0,"AssAmt":10.0,"GstRt":10.0,"IgstAmt":0.0,"CgstAmt":0.0,"SgstAmt":0.0,"CesRt":0.0,"CesAmt":0.0,"CesNonAdvlAmt":0.0,"StateCesRt":0.0,"StateCesAmt":0.0,"StateCesNonAdvlAmt":0.0,"OthChrg":0.0,"TotItemVal":10.0,"OrdLineRef":null,"OrgCntry":null,"PrdSlNo":null,"AttribDtls":null}]},"ExtractedSignedQrCode":{"SellerGstin":"17AACCC1596Q002","BuyerGstin":"37BZNPM9430M1kl","DocNo":"DOC-NO/51AS","DocTyp":"INV","DocDt":"11/03/2020","TotInvVal":0.0,"ItemCnt":"1","MainHsnCode":"1001","Irn":"716a970b33ee7be98b493d478650dc9af12424b9712e4e070547864fa065644e"},
"QrCodeImage":"<>",
"JwtIssuer":"NIC"}",
"ErrorDetails": null,
"InfoDtls": null
}
Error Responce
{
"Status": "0",
"Data": null,
"ErrorDetails": [
{
"ErrorCode": "2150",
"ErrorMessage": "Duplicate IRN"
}
],
"InfoDtls": [
{
"InfCd": "DUPIRN",
"Desc": {
"AckNo": 51100040597,
"AckDt": "2020-03-12 11:58:00",
"Irn": "6d62a2dd8b6c323bdcf873896637ea32022c8e13335573025cd73c269184586d"
}
}
]
}