See llms.txt for all machine-readable content.

Back to Templates

Issue GST e-invoices and e-way bills for Shopify orders via GSP and Google

Quick overview

This workflow triggers on paid Shopify orders, calculates GST and compliance routing, generates e-invoices (IRN/QR) or e-way bills via a GSP API, renders a PDF invoice with Gotenberg, archives it to Google Drive, emails it via Gmail, logs to Google Sheets, and posts failures to Slack.

How it works

  1. Triggers when a Shopify order is marked as paid.
  2. Loads seller configuration plus HSN and prior status from Google Sheets, then calculates GST splits, document numbers, and whether the order needs an IRN, an e-way bill, or no compliance document.
  3. If an IRN or e-way bill is required, authenticates with your GSP and calls the relevant GSP API, fetching an existing IRN when the portal reports it was already generated.
  4. Parses the GSP response to extract IRN, acknowledgment details, signed QR data, and e-way bill information, and posts an error to Slack when creation fails.
  5. Builds an HTML tax invoice (including QR code via quickchart.io when available) and renders it to PDF using a Gotenberg server.
  6. Saves the PDF to Google Drive, emails it to the customer via Gmail, writes IRN/e-way bill/invoice details back to the Shopify order as metafields and a tag, and upserts the transaction into the Google Sheets GST Register.
  7. Accepts IRN cancellation requests via an n8n form, validates the 24-hour cancellation window against the GST Register, cancels the IRN through the GSP API when allowed, updates the register, and reports the outcome to Slack.

Setup

  1. Create Shopify access-token credentials for the Shopify trigger and a Shopify Admin GraphQL token with write_orders, then replace REPLACE_STORE and set the header-auth credential used to update order metafields/tags.
  2. Add your GSP credentials as an HTTP Custom Auth credential and update the GSP auth/IRN/e-way bill/cancel URLs and seller GSTIN placeholders in the configuration and cancellation requests.
  3. Connect Google Sheets credentials and set the spreadsheet ID, then create the required tabs/columns for “HSN Map” (sku, hsn, gst_rate, uqc, is_service) and “GST Register” (order_id, order_name, doc_no, status, irn, ewb_no, created_at, etc.).
  4. Connect Google Drive and Gmail credentials, set the Drive folder ID for archiving PDFs, and ensure Gmail can send to customers and CC your accounts email.
  5. Connect Slack credentials, set the target channel ID for alerts, and deploy a reachable Gotenberg instance (and update the Gotenberg URL if it is not http://gotenberg:3000).