Search for a Shopify invoice API and you will find a mutation that sends an email, not an endpoint that returns a PDF. That gap trips up a lot of developers. The Shopify invoice API can notify a customer about an order, but building an actual invoice document is up to you or to an app.
This guide explains what the API does, what it does not do, and the three realistic ways to get invoices out of your store. You will also see which order fields to pull, how to handle numbering and refunds, and when it makes more sense to skip the build entirely.
What Does the Shopify Invoice API Actually Do?
The Shopify invoice API is not a single document generator. It is a small set of Admin API operations that act on orders, and the one most people mean sends an invoice email to the customer. It does not create a numbered, tax-compliant PDF for you.
Sending an invoice email with orderInvoiceSend
The GraphQL Admin API includes an orderInvoiceSend mutation. It emails an invoice notification for an order to the customer, using Shopify’s own email template. You pass the order ID and, optionally, email details such as recipient, subject and a custom message. Use it when you want Shopify to deliver a message that links the customer to their order.
What the API does not generate: a PDF invoice document
The mutation sends an email. It does not return a PDF, assign a legal invoice number, or add tax identifiers such as a VAT number. If your customers need a formal document, you must produce it separately from order data. That distinction matters for B2B buyers, who usually need a document their accounts team can file. Our guide to professional invoices on Shopify explains what that document should contain.
Billing API vs invoice API: two different things
Shopify’s Billing API charges merchants for apps and services. It has nothing to do with invoices you send your own customers. Looking for the bills Shopify sends you? See where to find and download Shopify billing invoices.
Shopify Invoice API: Three Ways to Generate Invoices
Since the API does not give you a finished document, you have three practical routes. Each trades build effort against control.
Option 1: Build the PDF yourself from order data
Read the order through the Admin API, then render a PDF with a library such as a headless browser or a PDF toolkit. You control every pixel and every field. The cost is ongoing: you own numbering, tax lines, storage, retries and every template change. Choose this route only if you have developer time to spare and unusual layout needs.
Option 2: Trigger documents from webhooks
Subscribe to order webhooks such as paid, fulfilled or refunded, and generate the document when the event fires. This keeps invoices in step with the order lifecycle without polling. Plan for duplicate deliveries: webhooks can arrive more than once, so make your generation step idempotent by checking whether an invoice already exists for that order.
Option 3: Use an invoicing app’s automation
An invoicing app listens to the same events, builds the document and emails it. You trade some flexibility for speed and for compliance work someone else maintains. Our guide to the Shopify invoice generator app landscape covers what to look for.
How Do You Build an Invoice From Shopify Order Data?
You build an invoice by reading the order, mapping its fields to a document layout, assigning a unique invoice number, and storing the result. The order holds the raw facts; your code adds the legal structure around them.
Fields to pull: order, line items, taxes, customer, company
Fetch these from the order object at minimum:
- Order name and created date
- Line items with title, quantity, unit price and discounts
- Tax lines with rate and amount per line
- Shipping lines and their tax
- Billing and shipping addresses
- Customer details and, for B2B, the company and any tax ID you store
- Currency and the presentment amounts
Request only what you use. Large GraphQL queries are slower and can hit cost limits.
Sequential numbering and storing the document
Do not reuse the Shopify order number as the invoice number. Many tax authorities expect a unique, sequential series, and order numbers skip when orders are cancelled or created as drafts. Keep your own counter and lock the number once the document is issued. Our guide to customizing the Shopify invoice number format shows how, and invoice numbering rules covers the rules by country. Store the generated PDF where you can retrieve it later, and record its invoice number against the order.
Refunds and credit notes
A refund changes the amount owed, so it needs its own document. Issue a credit note that references the original invoice number rather than editing the invoice you already sent. See how to send a credit note on Shopify after a refund.
Shopify Invoice API Pitfalls to Plan For
Most invoice bugs appear after launch, when real orders behave in ways your test orders did not.
Orders that change after the invoice is issued
Merchants edit orders, add items and refund lines. If you generate on creation, the document goes stale. Generate on payment or fulfilment, and treat later changes as credit notes or new invoices, never silent edits.
Multi-currency and tax-inclusive pricing
Orders can carry a shop currency and a presentment currency. Decide which one the invoice shows, and print any exchange information your tax rules require. Also check whether prices include tax, because your line maths must match what the customer paid.
Skip the Build: Automate Invoices With InvoiceForge
If the goal is invoices in your customers’ inboxes, not a PDF project, InvoiceForge handles the order events for you. It generates invoices and related documents from Shopify orders without custom code.
What is automated out of the box
InvoiceForge creates documents when orders are paid, fulfilled or refunded, applies your template, and keeps its own numbering. It covers invoices, receipts and credit notes. Try the free plan on a few real orders before committing developer time.
When custom API work is still worth it
Build your own when you must feed documents into a proprietary ERP, need a layout no template can reach, or have strict data-residency rules. Even then, you can use an app for the standard cases and reserve code for the exceptions.
Next Steps: Build or Buy?
Pick the route that matches your team and your volume, then validate it with a handful of real orders.
A quick decision checklist
- Do you need a document or only an email? If only an email, orderInvoiceSend may be enough.
- Do you have developer time to maintain numbering, tax lines and storage?
- Do you need custom layouts beyond a template editor?
- Do refunds and edits need credit notes?
If you answered no to the middle two, an app will save you weeks.
Related guides
Read our guides on Shopify packing slip templates and editing a Shopify invoice template next.
