November 3, 2026 · BY RAJ · E-INVOICING

E-Invoicing API Integration for Business Software in India

Over ₹5 crore turnover, your billing software must get an IRN and signed QR code from an IRP for B2B invoices. Most SMEs connect via a GSP with retries.

← All posts

Topics: Custom software & SaaS

Want this done for your business? Get a fixed quote or book a free 30-minute call.

Quick answer: If your aggregate turnover has crossed ₹5 crore in any financial year since 2017-18, your billing software must register each B2B invoice with an Invoice Registration Portal (IRP) and print the IRN and signed QR code it returns. Most SMEs connect through a GST Suvidha Provider (GSP), store every response, and queue submissions so a slow portal never stops billing.

Plenty of e-invoicing guides are written for accountants. This one is for whoever is commissioning or building the billing software: what the system has to send, what it must keep, and how it should behave on the evening the portal times out with a dispatch bay full of goods waiting for invoices.

Who needs e-invoicing built into their software?

Any GST-registered business whose aggregate turnover crossed ₹5 crore in any year from 2017-18 onwards, for B2B invoices, credit notes and debit notes, as well as exports. Once you cross the threshold, the obligation stays even if turnover later drops.

Some sectors are exempt, including banks and NBFCs, insurers, goods transport agencies, passenger transport services, cinema admissions and SEZ units. B2C invoices don't need an IRN.

There's also a timing rule worth designing for. Per GSTN's advisory, from 1 April 2025 businesses with aggregate turnover of ₹10 crore or more can't report an invoice to the IRP more than 30 days after its date. Software that lets invoices sit unregistered "to be done later" will eventually produce invoices that can't be registered at all.

If you're buying rather than building, our GST-ready business software checklist covers what to ask vendors.

How does an invoice get an IRN and a signed QR code?

Your software sends the invoice as JSON to an IRP, which validates it and returns a signed record you must store and print. The flow, step by step:

  1. Raise the invoice with a complete buyer GSTIN, place of supply, HSN codes, quantities, values and tax amounts.
  2. Validate locally before sending: GSTIN format, tax arithmetic, HSN length and totals. Catching errors here is faster than reading IRP error codes.
  3. Convert to the government e-invoice schema in JSON.
  4. Authenticate and submit to the IRP, directly or through a GSP.
  5. The IRP checks for duplicates and validates the data, then generates the Invoice Reference Number (IRN), a unique hash based on the supplier GSTIN, financial year, document type and document number.
  6. Receive the response: IRN, acknowledgement number and date, the digitally signed invoice and the signed QR code, plus e-way bill details if you asked for them.
  7. Store everything, render the QR code on the PDF or printed invoice, and send it to the buyer.

The IRP shares registered invoice data with the GST system, which auto-populates the relevant parts of GSTR-1. If you're new to how systems talk to each other, our explainer on what an API actually does is a gentle starting point.

Should you connect directly to an IRP or go through a GSP?

For most SMEs, a GSP or an existing accounting connector is the practical route. Direct access suits large businesses with an in-house tech team.

RouteHow it worksGood forTrade-offs
Direct IRP APIYour software calls the IRP itselfLarge taxpayers with in-house ITEligibility conditions, whitelisted IPs, encryption and token handling are yours to manage
Through a GSPYour software calls the GSP's API, which calls the IRPCustom software at most SMEsPer-transaction or subscription fees; one more party in the chain
Accounting or ERP connectorTallyPrime, Zoho Books or your ERP registers invoices for youBusinesses that bill from those toolsLittle control over retries and custom workflows

A good GSP handles authentication tokens, retries, routing between the NIC portals and the private IRPs authorised by GSTN, and plain-language error messages. If you bill in Tally but run orders elsewhere, our guide to integrating Tally and other accounting software explains where invoices should originate. And if Tally itself is straining under your invoice volume, our guide to when a business outgrows Tally covers the next step up.

How do e-way bills fit into the same API flow?

You can generate an e-way bill from the IRN in the same call or straight after, so capture transport details when the invoice is raised. Re-keying invoice data into the e-way bill portal is the most avoidable chore in Indian billing.

Generally, an e-way bill is needed when goods worth more than ₹50,000 move, with some state-level variations for movement within a state. Practical design points:

  • Add transporter ID, vehicle number, mode and approximate distance to the invoice screen, optional but prompted for goods invoices.
  • Allow the vehicle details (Part B) to be added later, since trucks are often assigned after billing.
  • Store the e-way bill number, date and validity alongside the IRN.
  • Alert dispatch before an e-way bill expires on long routes.

What should your software store, retry and log?

Store every response, make submissions idempotent, and never let a timeout create a second IRN. This is where integrations quietly fail.

What to persist for every document:

  • IRN, acknowledgement number and acknowledgement date
  • Signed invoice and signed QR code payloads, exactly as returned
  • E-way bill number, date and validity, if generated
  • The raw request and response, with timestamps
  • Current status: draft, queued, submitted, registered, rejected, cancelled

How to handle failures:

  • Idempotency. The IRP rejects a second registration of the same document number, so after a timeout, look the document up by its details instead of blindly resubmitting.
  • A queue with retries. Submissions go into a queue; transient errors retry with increasing delays; validation errors stop and go to a person.
  • Readable errors. Map IRP error codes to messages billing staff can act on, such as "Buyer GSTIN is inactive".
  • A manual fallback screen. If the IRP or GSP is down, staff can see what's pending and, if needed, register invoices through the portal's own tools rather than being blocked.
  • Alerts. Notify someone when invoices sit in the queue longer than an agreed time, especially if you're near the 30-day limit.

How do cancellations, credit notes and amendments work?

An IRN can be cancelled only within 24 hours, and not while an active e-way bill is linked to it; after that, corrections go through credit or debit notes.

SituationWhat the software should do
Error spotted within 24 hours, no e-way billCancel the IRN; issue a fresh invoice with a new document number
Error within 24 hours, e-way bill generatedCancel the e-way bill first, then the IRN
Error found after 24 hoursIssue a credit or debit note, which is also registered with the IRP
Price change or goods returnedCredit or debit note referencing the original invoice
Wrong details that can't be fixed on the IRPCorrect through the return process with your accountant's guidance

Two rules to enforce in code: a cancelled document number can't be registered again, and the IRP doesn't let you edit a registered invoice. Your software should make cancellation a deliberate action with a reason, and lock registered invoices against editing.

How do you test in the sandbox before going live?

Run your real invoice types through a sandbox until every edge case passes, then go live with one billing team first. The NIC IRP and most GSPs offer sandbox environments with test credentials.

  1. Register for sandbox access through your GSP or the IRP's developer portal.
  2. Build a test pack: a normal B2B invoice, an inter-state sale, an export, a credit note, a reverse-charge supply, a large multi-line invoice and a deliberately wrong GSTIN.
  3. Test failure paths: timeouts, duplicate submissions, expired tokens and cancellation after an e-way bill.
  4. Check the printed output: QR code size and placement, IRN and acknowledgement details.
  5. Ask your accountant to review a sample before production credentials are switched on.
  6. Go live with one location or team, compare against the portal for a week, then roll out.

Frequently asked questions

Is e-invoicing mandatory for my business?

It is if your aggregate turnover has exceeded ₹5 crore in any financial year since 2017-18, unless you're in an exempt category such as banking, insurance or goods transport. It applies to B2B invoices, credit and debit notes and exports. Confirm your position with your CA.

Can I generate e-invoices without a GSP?

Yes. You can enter invoices manually on an IRP's portal, use an accounting package with built-in e-invoicing, or apply for direct API access if you meet the IRP's eligibility conditions. For custom software at SME volumes, a GSP is usually the simplest reliable route.

What happens if the IRP is down when we raise an invoice?

A B2B invoice without an IRN isn't valid for a business that's required to e-invoice, so the goods should wait or the invoice should be registered as soon as service returns. Good software queues the submission, retries automatically and shows staff what's pending. Some GSPs can also route to another IRP.

Can an e-invoice be edited after the IRN is generated?

No. Within 24 hours you can cancel the IRN, provided no active e-way bill is linked, and issue a new invoice with a different number. After that, use credit or debit notes, or the return amendment process with your accountant.

Do B2C invoices need an IRN?

No. IRNs are for B2B supplies, exports and related credit and debit notes. Very large businesses have a separate dynamic QR code requirement on B2C invoices, which works differently from IRN registration.

Wire e-invoicing into your own software

If your billing runs on a custom system, e-invoicing should be a dependable background process, not a daily fire drill. Our custom business software development work designs IRN registration, e-way bills and accounting sync in from the start, with the failure handling tested before go-live. Tell us how you bill today for a fixed quote, usually within one business day.

Get a fixed quoteWhatsApp