GoCardless collects the Direct Debit payments. Xero records the invoices and accounts. Without an integration between them, someone has to match payments to invoices manually — checking GoCardless for confirmed payments, opening Xero, finding the matching invoice, marking it paid. For businesses with significant Direct Debit volumes, this is a daily reconciliation task that scales badly. A custom GoCardless Xero integration automates the entire flow: GoCardless confirms a payment, the integration finds the matching Xero invoice, applies the payment, and marks the invoice paid — automatically, without manual intervention.
How GoCardless and Xero connect
The integration uses GoCardless webhooks as the trigger. When a GoCardless payment changes state — confirmed, failed, paid out — GoCardless sends a webhook event to your server. The integration receives this event, identifies the matching Xero invoice, and takes the appropriate action.
The matching logic requires a link between the GoCardless payment and the Xero invoice. The most reliable approach is to store the Xero invoice ID on the GoCardless payment when it’s created — using GoCardless’s metadata fields or a reference field. When the payment confirmed webhook fires, the integration knows exactly which Xero invoice to update.
Once the invoice is identified, the integration calls the Xero payments API: amount, currency, the date of the GoCardless payment (not today’s date), and the Xero bank account that GoCardless funds settle into. Xero marks the invoice as Paid. The transaction appears in Xero ready for bank reconciliation when the GoCardless payout arrives.
The GoCardless payment lifecycle in Xero
GoCardless payments have a multi-state lifecycle that needs to be reflected correctly in Xero. Understanding the states — and when to act on each — is the core of the reconciliation logic.
Payment pending submission. The payment has been created in GoCardless but not yet submitted to Bacs. At this stage, the Xero invoice should remain in Awaiting Payment status. No action in Xero yet.
Payment submitted. The payment has been submitted to Bacs and is processing. The Xero invoice remains in Awaiting Payment. The money is on its way but not confirmed. No action in Xero yet.
Payment confirmed. This is the key event. The payment has been confirmed by Bacs — the money is secured and will arrive in the GoCardless payout. At this point, the integration applies the payment to the Xero invoice and marks it Paid. The invoice moves from Awaiting Payment to Paid in Xero.
Payment paid out. GoCardless has transferred the confirmed payment to your bank account as part of a payout. The integration can create a Xero bank transaction for the payout amount, ready for reconciliation against the actual bank transaction when it arrives. This streamlines the bank reconciliation process significantly.
Payment failed. The payment has failed — insufficient funds, mandate cancelled, bank account closed. The Xero invoice remains in Awaiting Payment status. The integration notifies your team and triggers the failed payment recovery flow. If payment is eventually recovered, the confirmed event fires and the invoice is marked paid at that point.
Creating Xero invoices automatically from GoCardless payments
For businesses that don’t already have a separate invoicing system, the integration can create Xero invoices automatically when GoCardless payments are created — rather than matching payments to pre-existing invoices.
The flow: payment scheduled in GoCardless (for a subscription renewal, for example), integration creates the corresponding Xero invoice immediately with the payment reference, invoice sits in Awaiting Payment until the GoCardless payment confirms, then payment is applied and invoice marked Paid. The entire invoice lifecycle is automated from the GoCardless payment schedule.
This approach works well for subscription and membership billing where GoCardless is the source of truth for the billing schedule. The invoice is created when the payment is scheduled, and marked paid when it confirms. No manual invoice creation in Xero, no manual reconciliation.
Handling failed Direct Debit payments in Xero
Failed GoCardless payments need careful handling in Xero to keep the accounts accurate. When a payment fails, the Xero invoice should remain in Awaiting Payment — the money hasn’t arrived, so the invoice isn’t paid. If the integration incorrectly marked the invoice as paid when the payment was created (rather than when it confirmed), a failed payment creates an accounting discrepancy that takes time to identify and fix.
A properly built integration only marks a Xero invoice Paid when the GoCardless payment confirmed event fires. If the payment fails, the invoice stays Awaiting Payment. If GoCardless retries the payment and it succeeds on a subsequent attempt, the confirmed event fires at that point and the invoice is marked Paid. The Xero books stay accurate throughout the retry cycle without any manual intervention.
For failed payments that are never recovered — customer cancels, debt written off — the Xero invoice can be written off or a credit note applied. This part of the flow typically requires a manual decision, and the integration can flag the invoice for review rather than automatically writing it off.
GoCardless payouts and Xero bank reconciliation
GoCardless pays out collected funds to your bank account on a daily or weekly schedule. Each payout is a single bank transfer that represents multiple individual payments. In Xero, this appears as one bank transaction that needs to be reconciled against the individual invoice payments.
The integration can create a Xero bank transaction for each GoCardless payout automatically, with the correct amount and date. Xero’s bank reconciliation feature then matches this transaction against the individual payments already applied to invoices. Instead of manually matching each payment to its corresponding invoice, the reconciliation becomes a matter of confirming what the integration has already done.
GoCardless also charges transaction fees that are deducted from payouts. The integration can create the payout bank transaction as the gross amount with a separate transaction for the GoCardless fees, keeping the fee expense correctly categorised in Xero.
Combined Stripe, GoCardless and Xero
For businesses using both Stripe and GoCardless alongside Xero — Stripe for initial card payments and GoCardless for recurring Direct Debit billing — the integration handles reconciliation from both payment processors. Stripe webhooks reconcile card payments to Xero invoices. GoCardless webhooks reconcile Direct Debit payments. Both use the same Xero OAuth connection and the same invoice matching logic. The result is a fully automated reconciliation layer that keeps Xero current regardless of which payment method was used.
For the full GoCardless service details, see the GoCardless API integration service. For Xero integration specifically, see the Xero API integration service. For Stripe and Xero together, see Xero and Stripe integration. For what the GoCardless build costs, see the GoCardless API integration cost guide.
Related posts
- GoCardless API integration: a complete guide
- GoCardless Direct Debit for subscription billing
- GoCardless vs Stripe: which is right for your business?
- GoCardless API integration cost
Contact sync between GoCardless and Xero
When the integration creates Xero invoices from GoCardless payments, it needs to associate each invoice with a Xero contact. The integration checks whether the customer already exists as a Xero contact — matching by email address — before creating the invoice. If the contact exists, the invoice is created under their existing record. If not, a new Xero contact is created automatically from the GoCardless customer data: name, email, address if available.
This contact sync prevents duplicate records building up in Xero over time. A GoCardless customer who has been paying for months shouldn’t have a new Xero contact created each time a payment is reconciled. Checking for an existing contact by email before creating a new one is a small addition to the integration that keeps the Xero contact list clean and avoids the manual deduplication work that accumulates when this check isn’t implemented.
VAT treatment on GoCardless reconciled invoices
Xero invoices created or reconciled via the GoCardless integration need the correct VAT treatment. For most subscription and recurring billing use cases, this means standard 20% VAT for UK businesses, zero rate for non-UK customers (for B2B services), or exempt for certain service categories.
The VAT mapping is configured during the integration build based on your Xero chart of accounts and tax setup. This should be agreed with your accountant before the build starts — getting VAT wrong on automated invoices at volume creates compliance problems that are time-consuming to fix. Once configured correctly, every reconciled invoice carries the right VAT treatment automatically.
For subscription businesses with both UK and international customers, the integration can apply different VAT treatments based on the customer’s location — standard rate for UK customers, zero rate or no VAT for EU B2B customers with a valid VAT number, and the appropriate treatment for rest-of-world customers. The customer location data comes from the GoCardless customer record or from your own platform’s customer database.
If you need help with a custom API integration for your website or business application, I can help. I build bespoke API integrations for UK businesses. See API integration pricing or get in touch to discuss your project.
Need a custom integration built?
I build custom API integrations — Stripe, Companies House and bespoke data pipelines. Reliable, well-documented, no agency overhead.
Discuss your project →
