# Sync settled Braintree payments into Xero every night

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

- Workflow type: code
- Services: Braintree, Xero
- Categories: Finance, Operations
- Published: 2026-07-17

## What it does

- Each night, gathers every Braintree payment that settled the day before and creates a matching money-in entry in Xero.
- Copies the exact amount and currency across, and tags every Xero entry with its Braintree transaction ID so each line ties back to the original payment.
- Uses the customer's name as the Xero contact and creates one entry per payment, keeping a clean one-to-one record between the two systems.
- Skips pending authorizations so only real, settled revenue ever lands in your books.

## What you'll need

- A Braintree gateway account with your payment history.
- A Xero organization you can connect, with a bank account set up to receive the money-in entries.
- No developer setup or spreadsheets required.

## Prompt

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.

## How to customize

- Change the run time (1am by default) or the day range it covers.
- Pick which Xero bank account the money-in entries post to.
- Adjust which payment statuses are included (settled and submitted-for-settlement by default).

## FAQ

### Will this create duplicate entries if it runs twice?

Each Xero entry is tagged with its Braintree transaction ID in the reference field, and the workflow only looks at the prior day's payments, so it can spot and skip any payment that already has a matching Xero entry.

### Does this book pending or authorized-only payments?

No. It only includes payments that have settled or been submitted for settlement, so pending authorizations are never counted as revenue.

### What happens with payments in different currencies?

The workflow copies each payment's original amount and currency onto the Xero entry, so multi-currency payments stay accurate.

### Do I need to match payments to existing invoices?

No. Each settled payment becomes its own money-in entry in Xero, giving you a clean one-to-one record against Braintree without invoice matching.

### Can I use QuickBooks instead of Xero?

This version posts to Xero, but the same nightly one-to-one approach works with QuickBooks Online using its sales receipt or deposit feature.

Use this prompt in General Input: https://www.generalinput.com/prompts/sync-settled-braintree-payments-into-xero-every-night