E Invoicing feature is not working

Not able to create E-invoice. Please help me to solve this issue.
This is the error log I’m getting.

401 Client Error:  for url: https://gsp.adaequare.com/gsp/authenticate?grant_type=token
----------------------------------------------------------------------------------------------------
Data:
{}
----------------------------------------------------------------------------------------------------
Exception:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 503, in fetch_auth_token
    res = self.make_request('post', self.authenticate_url, headers)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 475, in make_request
    res = make_post_request(url, headers=headers, data=data)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/integrations/utils.py", line 50, in make_post_request
    raise exc
  File "/home/frappe/frappe-bench/apps/frappe/frappe/integrations/utils.py", line 42, in make_post_request
    frappe.flags.integration_request.raise_for_status()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error:  for url: https://gsp.adaequare.com/gsp/authenticate?grant_type=token

Please help me to find the solution for this.

1 Like

Same here. Upgraded a test system to ERPNext 13 for this feature only.
Looking at the code in regional/india/e_invoice/utils.py #511

headers = {
			'gspappid': frappe.conf.einvoice_client_id,
			'gspappsecret': frappe.conf.einvoice_client_secret
		}

The client_id and client_secret are required to get this working. But the einvoice portal is not sending it after creating the API username and password. Looks like it’s an issue in both the systems.

@Saqib_Ansari can you guide on this?

FYI, the integration for Adequare comes built-in if you host your ERPNext accounts on erpnext.com or frappecloud.com… the database restoration is possible on both the services.

Does the Adequare integration work for self-hosted instances also? Are there any charges for this?

Yes. If you get Adequare’s E-Invoicing API subscription they will provide you with client credentials i.e client_id & client_secret which needs to be stored into common_site_config.json or site_config.json

This will solve the 401 Client Error.

Hope this helps.

1 Like

Also, we are planning to integrate ClearTax’s E-Invoicing solution in the upcoming month. (ref. April’s Roadmap).

Thanks @nextchamp.saqib. Please update the relevant documentation of E invoicing setup and add about purchasing the Adequare’s E-Invoicing API subscription separately.

@amit sir have you resolved it? Because i am facing the same issue.