E-Invoicing for Online Stores: Connecting Your Store and Payment Gateway
E-invoicing for online stores means deciding when the invoice is issued and how to handle returns and shipping. A practical guide with real cases and solutions.
سامي الحيدري

E-invoicing for online stores looks easier than in a physical shop because everything is automated. In practice, it raises questions that never come up at a counter: when exactly is the invoice issued? What about an order cancelled before it ships? And who is the buyer if they don't enter a VAT number?
The answers aren't purely technical. They are operational decisions that shape how your store is set up.
When should an online store issue the invoice?
This is the first decision and the most important one. There are three common options:
| Timing | Advantage | Drawback |
|---|---|---|
| When payment is completed | Simple and fully automated | Orders cancelled before shipping need many notes |
| When the shipment is prepared | Fewer cancellations | A gap between payment and invoice confuses the customer |
| On delivery | Matches the actual supply | Complicated with third-party shipping and cash on delivery |
No option is right for everyone. A store where a large share of orders is cancelled before shipping benefits from issuing later, while a store that ships within hours benefits from issuing at payment.
What matters is that you choose one and stick to it, and that it matches the policy you publish to customers.
E-invoicing for online stores: simplified or tax invoice?
An individual customer needs a simplified invoice, while a business customer needs a tax invoice. The store can't tell the difference unless it asks.
The practical fix: an optional field at checkout labelled "Buying on behalf of a business?" that opens two fields for the VAT number and address. Once they are filled in, the invoice type switches automatically.
Validate the number's format before accepting it. Stores that accept any text in this field end up with a pile of rejected invoices.
Returns and cancellations: the most confusing part
- Cancellation before the invoice is issued: nothing is required, because no invoice exists yet.
- Cancellation after issuing but before shipping: a credit note for the full amount.
- Partial return: a credit note for the returned items and their VAT only, not for the whole invoice.
- Exchanging one item for another: a credit note for the returned item and a new invoice for the replacement, or a debit note if the replacement costs more.
A store that invoices at payment and cancels one in five orders will issue a large number of notes every month. That isn't an error, but it is a good reason to rethink when you issue invoices.
Cash on delivery: the hardest case
Cash on delivery separates supply from collection by days, and sometimes ends with the customer refusing the parcel at the door. That makes invoice timing a real decision, not a formality.
Three points settle it:
- Don't issue the invoice when the order is placed in this case, because refusal at the door is far more common with cash on delivery than with prepayment.
- Tie issuance to actual delivery, meaning the shipping company's confirmation, not the parcel leaving your warehouse.
- Account for the timing difference: revenue is recognised on supply, and the cash arrives later. This is a normal accrual difference, not an error.
Stores that issue the invoice at order time for cash-on-delivery sales find themselves issuing a high share of credit notes every month for no real reason.
Coupons, points and wallets
- Discount coupon: a discount on the line items shown on the invoice, with VAT calculated on the net amount after the discount.
- Wallet balance or points: a payment method, not a discount. The invoice value stays in full, and the wallet pays part of it.
- Previously sold gift card: selling it is usually not revenue at the time of sale; revenue is recognised when it is redeemed.
Mixing up discounts and payment methods produces invoices with wrong VAT amounts, and it is one of the most common causes of rejection for online stores.
Shipping and additional charges
Shipping fees are a line item on the invoice with their own VAT treatment, not an amount added outside the lines. Free shipping as part of a promotion is treated as a discount on the line items, not as a line with a value of zero.
If shipping is handled by a third party that invoices you, that invoice is your expense and not part of your revenue, even if you collect the amount from the customer.
Integrating with e-commerce platforms
If your store runs on a ready-made platform, ask three questions before anything else:
- Is Phase 2 integration included, or is it a separate paid add-on?
- Does the store issue invoices itself, or does it send the order to your accounting system to issue them?
- If you have an online store and physical branches, do they work together in one system, or separately with two counters?
The third question determines how many invoicing units you need, and whether you reconcile your sales from one source or two.
Monthly reconciliation for an online store
At the end of each month, reconcile three figures that should match: store sales, total invoices issued minus notes, and payment gateway receipts after gateway fees.
Any difference between the first and second means orders without invoices, or the reverse. Any difference between the second and third means gateway fees that weren't recorded as an expense.
The detailed requirements for issuance timing, supply and notes are published by the Zakat, Tax and Customs Authority (ZATCA).
Selling outside Saudi Arabia
If your store ships abroad, exports have a different VAT treatment, often at zero rate, provided you keep documents proving the goods left the country. Don't treat it as a domestic sale, and don't assume the rate before reviewing your specific case with your accountant.
Key takeaway: Choose one invoice timing that fits your cancellation rate and payment methods, treat coupons as discounts and wallets as payment, and reconcile store sales, invoices and gateway receipts every month.
Read also
- Tax invoice vs simplified invoice
- Credit and debit notes: how to correct an invoice
- EGS units and multiple branches
To see how SmartPro connects your online store to sales, inventory and Fatoora Phase 2 invoicing, explore SmartPro for e-commerce or start a free trial.


Frequently asked questions
When should an online store issue the invoice?
There are three options: when payment is completed, when the shipment is prepared, or on delivery. A store where a large share of orders is cancelled before shipping benefits from issuing later, while one that ships within hours benefits from issuing at payment. What matters is choosing one and sticking to it.
How does an online store know the buyer is a business?
Through an optional checkout field asking whether the purchase is on behalf of a business, which opens two fields for the VAT number and address. Once they are filled in, the invoice type switches automatically from simplified to tax invoice. The number's format should be validated before it is accepted.
How do I handle a partial return?
Issue a credit note for the returned items and their VAT only, referencing the original invoice. Don't cancel the whole invoice and issue a new one for the remainder, because that creates three documents and inflates your sales and returns figures.
Are shipping fees included in the invoice?
Yes, as a line item with its own VAT treatment, not as an amount added outside the lines. Free shipping as part of a promotion is treated as a discount on the line items. An invoice the shipping company issues to you is your expense, not part of your revenue.