In this guide
Why duplicate invoices appear in Sage
A WooCommerce order should normally produce one intended accounting document in Sage Accounting. Yet an integration can create two invoices for the same checkout even when the customer placed only one order. The usual mistake is treating each incoming notification as permission to create a fresh document.
WooCommerce orders can change several times: an order is created, a payment status changes, stock or customer details are updated, and an administrator may edit the order later. Integrations also have to cope with lost connections, delayed responses and jobs being retried. None of those events necessarily represents a new sale. A reliable WooCommerce-to-Sage integration must recognise the difference.
Start by identifying the duplicate
Before changing anything, open the two Sage documents and compare their source order reference, customer, date, line items and totals. Then check the corresponding WooCommerce order history. Was there one checkout with two accounting documents, or did the customer actually submit two orders? These cases require different solutions.
Next, inspect the integration logs. Look for repeated webhook deliveries, scheduled synchronisation jobs, manual re-runs and API requests made around the time the invoices were created. A pair of identical Sage invoices is a symptom. The logs tell you which process created them, provided the integration records requests and responses properly.
If you are already reconciling a real accounting period, ask the person responsible for your books how duplicates should be reversed or credited. Deleting accounting records without considering audit trails, VAT and payment allocation can create a second problem.
Why a webhook is not an invoice instruction
A webhook tells another system that something happened. It does not, by itself, confirm that an invoice must be created. WooCommerce can issue notifications when an order is created or updated; a developer might also run a scheduled task to catch missed events. If both paths simply call a create-invoice function, the same order may reach Sage twice.
Consider a customer who places order 10482. The order is first recorded while payment is pending. A payment confirmation changes its status, and a later address correction updates it again. If all three events trigger invoice creation, three accounting documents may result from one purchase.
The integration needs a business rule instead: decide which WooCommerce state authorises the chosen Sage document, then ensure that the decision can be applied only once. The correct status depends on the payment method, fulfilment process and accounting workflow. A pending bank-transfer order may be handled differently from an already-paid card order.
Give every intended document a unique identity
The strongest protection is an idempotent integration. In plain language, running the same operation twice should not create a second invoice.
Store a mapping between the WooCommerce order and the Sage document. A useful internal key combines the connected Sage company, the WooCommerce order ID and the document type. That distinction matters if your business legitimately creates a quotation or sales order before issuing an invoice. The mapping should also store the Sage document identifier, its creation state, timestamps and the last synchronisation result.
Enforce uniqueness in the integration database, not only in application code. Two workers can receive the same event at almost the same time. If they both check for an existing record before either writes one, both may think they are first. An atomic reservation or database uniqueness constraint prevents that race.
An important detail: do not mark an invoice as safely created before Sage confirms it. Equally, do not create a second invoice merely because your connection timed out. The request may have succeeded even if the response never reached your server.
Handle timeouts without guessing
Imagine the integration sends a create request to Sage. Sage accepts it, but the connection drops before the response arrives. The integration sees a timeout and queues a retry. Sending the same create request again without checking can produce a duplicate.
Treat this as an uncertain outcome rather than a definite failure. Record the request reference and the state as needing reconciliation. Before trying again, look up the expected Sage document using an available source reference or another supported lookup mechanism. Only create a new document once you have established that the first attempt did not succeed.
Do not assume every API provides a native idempotency-key feature. Confirm the capabilities of the Sage product and endpoint your business actually uses. Your own durable mapping and reconciliation process are important regardless.
Separate new sales from later edits
A new order and an updated order should not follow identical processing paths. Once a Sage invoice exists, a WooCommerce address correction should normally prompt a review or supported update, not another invoice. A cancelled order, partial refund or returned item needs an explicit accounting rule. Depending on the situation, that might involve a credit note, a payment adjustment or another authorised document.
Write down which system is authoritative for each field. WooCommerce might be the source for checkout details, while Sage remains authoritative for posted accounting documents and payment reconciliation. If both systems can freely overwrite each other's data, ordinary corrections can become a cycle of conflicting updates.
Check totals before posting
South African stores often need careful treatment of VAT, delivery charges, discounts and rounding. Even when the duplicate problem has been solved, incorrect mappings can leave WooCommerce and Sage with different totals.
Compare the order subtotal, discounts, shipping, tax and grand total before creating the document. Confirm whether prices are tax-inclusive or tax-exclusive and how each system handles rounding. Make the integration flag mismatches for review rather than silently adjusting figures. Check that the mapped customer, product codes and tax treatment are appropriate for the transaction.
This is also where a test environment earns its keep. Use realistic examples: a discounted order, a delivery charge, a zero-rated item where applicable, a refunded purchase and an order whose status changes more than once. Have an accountant confirm the intended treatment before deploying a new accounting workflow.
Make the sync observable
A dashboard should make it possible to answer a simple question: what happened to order 10482? At minimum, record the WooCommerce order ID, connected Sage company, action attempted, event received, processing state, Sage document ID, timestamp and error outcome. Protect personal information and credentials; a useful audit trail does not require exposing payment details or API secrets.
Give staff understandable states such as waiting, processing, synchronised, review required and failed. A failed job should be retryable without manufacturing another invoice. Reconciliation should compare completed WooCommerce orders against known Sage documents and flag missing, duplicated or mismatched records.
Include a manual review route for uncertain outcomes. Automation is valuable because it reduces repetitive work, not because it removes every decision from finance staff.
A practical implementation sequence
First, agree on the accounting workflow: which order state creates which document, and what happens after cancellations or refunds. Second, create an integration database with a unique order-to-document mapping. Third, process incoming WooCommerce events through a queue so that validation, retries and logging happen consistently. Fourth, reconcile uncertain API outcomes before retrying a create operation. Finally, test repeated events, simultaneous jobs, dropped connections and manual reprocessing before going live.
If the current connector is a third-party plugin, start by checking whether its existing configuration already covers duplicate detection, document references and status mapping. Replacing it should not be the first reaction. Sometimes a configuration change solves the issue; sometimes the business needs a more controlled custom integration.
When custom development makes sense
A basic connector may be sufficient for a shop with straightforward sales and accounting rules. Custom development becomes more relevant when you need multiple Sage companies, approval workflows, unusual stock movements, split fulfilment, specialised tax handling or integrations with other systems.
Digital4Front develops WooCommerce integrations and business software around the way a company actually works. If your WooCommerce-to-Sage synchronisation is producing duplicate documents, losing updates or requiring constant manual correction, we can help you investigate the workflow and design a safer integration. The goal is not simply to move data between platforms; it is to make every transaction traceable and reliable.
