[E-Invoicing][India][Guide] Setup Adequare GSP's E-Invoicing Services in ERPNext

This guide is intended to help open-source users who want to use e-invoicing API solution in ERPNext.

As e-invoicing is becoming mandatory for businesses in India, we at Frappe have integrated ERPNext with Adequare GSP’s e-invoicing services. As of now, only their APIs are integrated with no flexibility to integrate other service provider’s APIs. However, this might change in near future as we are planning to integrate with ClearTax too.

Let’s Begin,

Step 1: Get your client credentials from Adequare GSP by subscribing to their e-invoicing app.
Step 2: Once you obtain Client ID & Client Secret, you must save these into sites/common_site_config.json. This will enable all of your sites on that bench to authenticate for e-invoicing.
Step 2: For Frappe Cloud users, you will have to add these 2 keys in the “Site Config” tab of a particular site.

Production

Step 3: You just need to follow the Setup E-Invoicing guide from ERPNext documentation for production access.

Sandbox Testing

Step 3: If you want to test in a sandbox environment, enable the Sandbox checkbox and enter the sandbox credentials that Adequare has forwarded you at the time of subscription, in the E-Invoice Settings

Step 4: The sandbox GSTIN used in the E-Invoice Settings (eg. 01AMBPXXXXXXXXX) needs to be saved into the company address GSTIN field. The appropriate GST State (eg. Jammu & Kashmir) & Pincode (eg. 193502) needs to be updated as well.

That’s It!

8 Likes

Cool! Thanks much for first making this happen and then putting this document together.

Thanks

Jay

@JayRam Sir I am doing E-Invoicing for a client but it shows some JSON error while generating IRN.
My doubt is can the Billing Address and shipping Address same in a invoice .
Because the GSTIN gets same in the address.
Please help me with this information.

I did setup right but can’t generate IRN.

Sir,
Thanks In advanceCapture

Hi Shivansh

Search in the awesome bar for E Invoice Request Log, and post the data here for the requests that are giving an error.

Somebody here should be able to help you better with that information.

Thanks

Jay

@JayRam Sir actually I checked that And i am able to generate IRN .
Now the scenario is i can’t generate IRN for a particular customer having i.e like Reliance
having four address in four different states so we made 4 customers 4 all four.
now while generating for that customer i am only getting that error.

Yeah. But the reason for that error is in the the JSON which is in the E Invoice Request Log. Producing the contents of that will help somebody identify the problem and suggest workarounds and/or fix the underlying issue.

Thanks

Jay

sure sir

@JayRam sir i can find the only those logs which are success.

Okay. You should be able to find the JSON Info in the Browser Console as you try to generate an E-Invoice. Paste from there and post it here.

Thanks

Jay

@JayRam sir This is the trace i am getting in console.
kindly look into it please help me…if it gets a clue to solve.
this happens for only one customer.

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 67, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 59, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 24, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 64, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1074, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/india/e_invoice/utils.py”, line 813, in get_einvoice
return make_einvoice(invoice)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/india/e_invoice/utils.py”, line 361, in make_einvoice
einvoice = json.loads(einvoice)
File “/usr/lib/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.6/json/decoder.py”, line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 29 column 46 (char 730)

We usually got these errors when integrating e-invocies services to ERPNext.

Can Item Code or Item Name may have TAB char or something like that.

PS: We also have a “Log Reqeusts and Responses” check besides the “Testing” (Sandbox) check in the settings. So we can check error whole request and response in the error log. ERPNext team may also use that feature.

Hi we are done with the configuration for e-invoicing but when we generate IRN showing the error message
The field address line 1 must be a string with a minimum length of 1 and a maximum of 100 same for the address2 in our addresses 1 and 2 there are numbers/special characters and strings. If we keep only characters in that case same error showing for generating IRN.
unnamed

unnamed

This happens only on some old data

You can edit the address line 1 & 2 to resolve the issue. Just edit the address lines and save the company and customer addresses

Thanks for posting. However, I cannot save this test GSTIN (01AMBP*****M002) to the company address as it says invalid GSTIN. I am unable to test in sandbox mode. How to proceed?

Hi @Basant ,

Did you find the solution for this??

Even I am facing the same issue.

Thanks & Regards,
Sujay

I think you will have to Disable GST validation under GST setting

@Sujay Create a new test GSTIN on GST developer portal and use that. The default adequare gives doens’t work.