Sync settled Braintree payments into Xero every night

By General Input

Every night, yesterday's settled Braintree payments post to Xero as receive-money entries tagged with their transaction IDs so the books reconcile themselves.

Integrations

  • Braintree
  • Xero

Type

Deterministic Code

Categories

  • Finance
  • Operations

Every night at 1am, sync the prior day's settled Braintree payments into Xero so the books reconcile against the payment gateway without manual entry. This is a deterministic one-to-one export: one settled Braintree charge in equals one receive-money bank transaction out, one Xero entry per Braintree transaction.

Trigger this on a cron schedule, nightly at 1am, scoped to the previous calendar day. Use Braintree Search Transactions to pull every transaction whose status is settled or submitted for settlement with a settlement or submission date that falls within the previous day. Page through the full Relay-style connection (advance by endCursor until hasNextPage is false) so no transaction is missed. Exclude every other status, especially pending authorizations, so charges that have not captured are never booked as revenue.

For each matching transaction, create a matching receive-money entry with Xero Create Bank Transactions (type receive money). Map the Braintree amount and currency to the Xero line total, use the Braintree customer name as the contact, and put the Braintree transaction ID into the reference field so each Xero entry ties back to its source payment. Braintree amounts are decimal strings in the transaction's currency and Xero money fields are decimals, so pass the amount straight through. Create exactly one Xero bank transaction per Braintree transaction.

Post every entry to a single configured Xero bank account. Because each entry carries its Braintree transaction ID in the reference field, the export can skip any transaction that already has a matching Xero entry, so re-running the same day never double-books.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentPartner payout approval queue with Xero bill handoffBooked vs collected cash flow desk for HoneyBook studiosClient hosting cost and margin portal for DigitalOceanSupplier risk board for Xero, checked against the UK registerCheckout.com to Xero month-end reconciliation workbenchBraintree failed-payment recovery queue for billing teamsBraintree settlement reconciliation workbench for month endBraintree customer billing lookup for support agentsAccounts payable review desk for supplier portal invoices