Amazon Seller Central to Xero Accounting Sync (n8n)

Automate Amazon revenue recognition and inventory reconciliation using n8n's visual workflow engine

Tools: AmazonXero

Platform: n8n

Short Answer

A fully automated workflow that captures Amazon orders in real-time or via settlement reports, maps them to Xero Invoices, creates line items for fees, and ensures inventory counts remain synchronized across platforms.

The Problem

Manually reconciling Amazon sales with Xero is time-consuming and prone to human error, especially regarding tax calculations and FBA fees. Without automation, inventory levels often drift between Seller Central and the general ledger, leading to inaccurate financial reporting.

The Outcome

A fully automated workflow that captures Amazon orders in real-time or via settlement reports, maps them to Xero Invoices, creates line items for fees, and ensures inventory counts remain synchronized across platforms.

Step-by-Step Guide

1. **Configure Credentials**: Open n8n, go to 'Credentials' and add 'Amazon Seller Central' (requires Client ID, Secret, and Refresh Token from Amazon Developer Console) and 'Xero OAuth2' credentials. 2. **Set Amazon Trigger**: Add the 'Amazon Seller Central' node. Set the Resource to 'Order' and Event to 'On Order Status Change'. Filter for status 'Shipped' to ensure revenue is only recognized upon fulfillment. 3. **Handle Order Items**: Amazon's initial trigger doesn't always provide full line-item SKU details. Add an 'Amazon Seller Central' node or 'HTTP Request' node to fetch details for the specific `AmazonOrderId` received from the trigger. 4. **Data Transformation**: Add a 'Code Node'. Use JavaScript to map Amazon's array structure to Xero's required format. Specifically, transform the `ItemPrice` and `PromotionDiscount` into distinct line items. 5. **Sync Contact**: Add a 'Xero' node. Set the Action to 'Get/Create Contact'. Map the Amazon 'Buyer Name' or use a generic 'Amazon Customer' contact ID to keep your Xero contact list clean. 6. **Create Invoice**: Add another 'Xero' node. Action: 'Create Invoice'. Use expressions (e.g., `{{ $json.orderId }}`) to map the Amazon Order ID to the Xero Reference field. Set the 'Status' to 'AUTHORISED'. 7. **Tax Logic**: In the Xero node, use an n8n Expression to apply Tax Types based on the `ShippingAddress.State` or `CountryCode` provided by Amazon. 8. **Inventory Update**: Add a 'Xero' node for 'Update Item'. Use the SKU from Amazon to find the matching Item Code in Xero and decrement the quantity based on the order. 9. **Error Handling**: Create an 'Error Trigger' workflow. If any node fails (e.g., Xero API limit reached), this sub-workflow should log the error and send a notification to a Slack channel via the 'Slack' node.

Data Mapping

| Amazon Field | Xero Field | n8n Expression / Logic | Required | | :--- | :--- | :--- | :--- | | `AmazonOrderId` | Reference | `{{ $json.AmazonOrderId }}` | Yes | | `PurchaseDate` | Date | `{{ $json.PurchaseDate.toISODate() }}` | Yes | | `BuyerEmail` | Contact Email | `{{ $json.BuyerInfo.BuyerEmail || 'no-reply@amazon.com' }}` | No | | `SKU` | Item Code | `{{ $item.SellerSKU }}` | Yes | | `ItemPrice.Amount` | Unit Amount | `{{ $item.ItemPrice.Amount / $item.QuantityOrdered }}` | Yes | | `ShippingTax` | Tax Amount | Map to Xero Tax Type ID via manual mapping table | Yes | | `CurrencyCode` | Currency | `{{ $json.OrderTotal.CurrencyCode }}` | Yes | | `FBA Fee` (Settlement) | Line Item | Map to 'Amazon Fees' Expense Account | No |

Gotchas & Failure Modes

• **Rate Limiting**: Amazon SP-API and Xero both have strict rate limits. Use n8n's 'Wait' node or 'Split In Batches' node if processing large volumes of historical orders. • **SKU Mismatch**: xero will fail if the Amazon SKU does not exist in Xero's Item list. Always ensure SKUs are identical or add a 'Lookup' node to translate them. • **Rounding Discrepancies**: Amazon provides totals including tax, while Xero can be tax-exclusive. Use the n8n Code node to normalize values to 2 decimal places using `Math.round(val * 100) / 100`. • **Self-Hosting Memory**: If running n8n on a small VPS, settlement reports with thousands of lines can cause memory spikes. Increase the `N8N_PAYLOAD_SIZE_MAX` environment variable if needed.

Verification Checklist

- [ ] **Trigger Test**: Run the Amazon node manually and ensure it retrieves a 'Shipped' order. - [ ] **JSON Validation**: Check the n8n Output panel to ensure the 'Code Node' produces a valid array of items for Xero. - [ ] **Contact Duplicate Check**: Verify that the n8n workflow finds existing Amazon contacts in Xero rather than creating duplicates. - [ ] **Live Sync**: Perform a test purchase (or use a recent real order) and verify the Invoice Reference matches the Amazon Order ID exactly in Xero. - [ ] **Execution Logs**: Check the 'Executions' tab in n8n for any 'Workflow Execution Failed' errors during the first hour of live operation.

Ready to Automate?

Build this automation with n8n in minutes.