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.
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.
@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.
@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.
@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.
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?