How to Set-up Synch of Order Status in WooCommerce When Invoice is Paid in Xero
Update Xero Invoice Payments to WooCommerce Orders
Once payment is made by the customer then it will show in Xero’s automatic bank feeds either as an individual payment which can be matched with payments sent by Xeroom or as an aggregate consolidated payment that covers multiple invoices. Your bookkeeper will reconcile these actual payments into the bank with the invoices and automatic matching rules can be utilised. When an invoice is paid off in Xero this will trigger Xeroom to update the order status back in WooCommerce. It will show the order Xero status as “Paid in Xero” in blue and also change the order status to “Completed”. It takes around 2 mins for the update to show in WC.
The light blue outline to the box indicates that the invoice has been sent automatically by Xeroom earlier in the process.
Payment Synch Setup in Xeroom
Xeroom uses a webhook that gets triggered by Xero on certain events such as payment. To obtain your webhook go to your Xero app in https://developer.xero.com/ and under webhooks.
Tick the invoices box and add the delivery URL which is usually:
https://www.websitename/wp-json/xeroom/v2/invoice_callback
where websitename is your own website name with correct ending ie .com or.co.uk etc. To get the exact URL take the URI given in blue in your Xeroom settings and after the V2 add “invoice_callback” as the suffix.
When you hit save it will generate a webhook and status box. Copy this webhook into the box in Xeroom and save it. Then go back and hit the “Send intent to receive” button. If everything is good then you will get an “ok” message. If it fails the status will be red. Check your settings are correct.
NB: Ensure that you have set a default bank account in Xeroom with the same Xero accounts code as you are using to make the payment to in Xero. Also wait 3 mins for the webhook to synch from Xero before the Xero status for the order in the WooCommerce order dashboard status changes to “Paid in Xero” and turns a solid blue.
Errors and Troubleshooting The Xero Webhook
Before you contact support please go through the following troubleshooting checklist. If the webhook has failed you will get the a “Response not 200” message in the Xero . Response 200 is a success message which means the communication to your server was successful so if it fails it is either an issue with Xeroom (sometimes after an upgrade a bug might cause a problem) or most likely reaching your server or a server setting preventing the response. Please check the following:
- Check if your server firewall or any security plugs are blocking the request. Any access requests will show in your firewall/security plugin audit logs. We do add a Xero User Agent to the calls made from the Xero webhook so that they should get recognised by the likes of the GES (Global Edge Security) firewall used by WP Engine to add Cloudflare features. The User Agent will automatically whitelist them but check the logs to ensure that this is working properly otherwise the call will be blocked.
- Check for Cloudflare or other caching or anti-bot apps that you are using to see if they are blocking it. If so you will need to whitelist the delivery URL so that it doesn’t get blocked.
- Check that your server has Ngnix enabled and set the default application to Xeroom.
- Install the Rest API Log plugin which is under tools and that gives a lot more info on the request https://www.websitename/wp-admin/tools.php?page=wp-rest-api-log-view-entry&id=1087
- Recreate your webhook, copy and paste it and try the “send intent to receive” again.
- Check your WC debug log for error messages – see below.
- Contact Xero support as they have more visibility on the errors arising and may be able to shed light on the issue and User Agents.
Accessing The WooCommerce Debug Log
Please check for any serious error messages in Woocommerce\Status\logs. Other errors will show in the Woocommerce debug.log file found in the WP-content directory for any warnings or errors relating to Xeroom. To set this see here https://docs.woocommerce.com/document/woocommerce-product-search/api/debugging/ and for general WordPress debugging here https://wordpress.org/support/article/debugging-in-wordpress/ This file will be large and log all messages including advisory ones. Remember not to leave it on otherwise it will show to the users. Copy and paste the relevant Xeroom messages if any are found for reference or to pass to us as part of any support request.
Contacting Support
If none of the above resolves the issue then something more complex is afoot so please open a support ticket to [email protected] and ensure that you provide us with the following information in order to help you in a timely manner:
1. Copies of any errors found in your WC debug log.
2. Copy of any recent errors in your Xeroom debug page.
3. Send an admin login to your site and invitation to your Xero account for a standard business user.
4. Provide us with FTP access to your server.
5. Send any relevant info from the troubleshooting list above especially firewall and caching logs.