E-Commerce
Use this path when orders or payments in your commerce system should trigger invoice creation automatically. The key decision is not whether invoicing is possible, but when the document should be issued and how refunds, cancellations, and delivery are handled.
Who This Is For
- stores and commerce platforms issuing invoices from order or payment events
- engineering teams integrating documented order flows or custom commerce backends
- teams that need a reliable order-to-invoice and refund-to-credit-note path
Best Fit / Not A Fit
Best fit
- you already have order data and want compliant invoicing downstream
- you need invoices, PDFs, and delivery logic tied to payment or fulfillment milestones
- you want cross-border tax handling without custom tax logic per market
Not a fit
- you only need manual invoicing with no relation to order data
- you expect generic checkout tooling rather than invoicing infrastructure
- you have not decided whether invoices should be created on order, payment, or fulfillment
Recommended Integration Path
- use the JavaScript SDK or direct API if your store backend already handles order events
- use the Order Integrations API if you are working with a documented supported order-integration flow
- keep invoice issuance logic on your backend, even if storefront actions trigger it
Entity Model
Common models are:
- one entity per store or legal merchant
- one entity per regional business if tax and branding differ by market
Do not collapse unrelated legal sellers into one entity just because they share a commerce stack.
First Sandbox Milestone
Prove this in sandbox before rollout:
- create one test entity for a store
- turn one order into one invoice
- render and inspect the PDF
- confirm invoice timing for paid, unpaid, and refunded orders
- create a credit note for a refund and verify totals
Invoice from Order
Convert order data to a compliant invoice:
// title: Create invoice from order
const _invoice = await sdk.invoices.create(
{
customer: {
name: order.billingAddress.name,
email: order.email,
address: order.billingAddress.street,
city: order.billingAddress.city,
zip: order.billingAddress.zip,
country: order.billingAddress.country,
},
items: order.items.map((item) => ({
name: item.productName,
quantity: item.quantity,
price: item.unitPrice,
})),
note: `Order #${order.orderNumber}`,
},
{ entity_id: entityId },
);Send with Order Confirmation
// title: Send invoice to customer
await sdk.email.send(invoice.id, {
to: order.email,
subject: `Invoice for Order #${order.orderNumber}`,
message: "Thank you for your purchase! Please find your invoice attached.",
});Common Workflow And Gotchas
- decide whether to issue on
order created,payment confirmed, orfulfilled; that is the first real product decision - store your order ID in document
metadataso reconciliation stays easy - use credit notes for refunds instead of mutating finalized invoices
- keep per-store entities when numbering, tax rules, or branding differ
- validate email behavior in sandbox before assuming live delivery behavior
Compliance Notes
- seller country and buyer location both influence tax handling
- EU B2B transactions may require VIES validation and reverse charge treatment
- refund and cancellation flows need credit-note logic, not just order status changes
- if fiscalization applies in a market, sandbox should be used to validate the flow before live issuance
Why This Works
- Automatic compliance — Tax rates based on customer location
- Order linking — Use
metadatato link invoices to orders - Instant delivery — Email invoices automatically on purchase
- Multi-currency — Support international customers
Integration Points
| Event | Action |
|---|---|
| Order completed | Create invoice |
| Payment confirmed | Send invoice email |
| Refund issued | Create credit note |
Integration Flow
E-commerce integration flow
┌──────────────┐ ┌─────────────────┐ ┌──────────────┐
│ Customer │ │ Your Store │ │ Space │
│ Checkout │────▶│ Backend │────▶│ Invoices │
└──────────────┘ └─────────────────┘ └──────────────┘
│ │
│ 1. Order completed │
│─────────────────────▶│
│ │
│ 2. Create invoice │
│─────────────────────▶│
│ │
│ 3. Send to customer │
│─────────────────────▶│
│ │Clear Next Action
First decide exactly when an order becomes an invoice in your system, then prove that event path in sandbox with one refund case.
- Start free sandbox
- Order Integrations API — inspect documented supported order flows
- Invoices Guide — full document lifecycle
- Other Documents — credit notes for refunds