Skip to main content
POST
Sync invoices and payments
Creates or updates invoices and their payments in one request. Layer applies the invoices first, then the payments and their dedicated refunds, and validates invoice balances once at the end. The request is atomic. If any invoice, payment, or refund fails, nothing is saved.

Request rules

  • Send payments in the top-level payments list, not inside an invoice.
  • If a payment pays several invoices, include all of those invoices in the same request.
  • external_id values must be unique within invoices and within payments.
  • Payments that you don’t include are left unchanged.

Example

Request

Rate Limiting

This endpoint shares its rate limit with Bulk create invoices and Batch create invoices. For details on rate limit headers, see Rate Limiting.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Content-Type
string

Content-Type must be set to application/json.

Path Parameters

businessId
string<uuid>
required

The UUID of the business to sync invoices for.

Body

application/json

Invoices and payments to apply in one atomic request.

invoices
object[]

Invoices to create or update, matched by external_id. Each uses the same parameters as the create invoice endpoint, except that payments must be omitted. Send payments in the top-level payments list.

payments
object[]

Payments to create or update, matched by external_id. Each uses the same parameters as the bulk create invoice payments endpoint, including dedicated_refunds. A payment may allocate to several invoices.

Response

Every invoice and payment was applied. Returns each invoice and payment in its final state.

data
object
required

Final state of the invoices and payments in a sync request.