scheduled → open → paid, with deviations to past_due, unpaid, canceled, and refunded).
This API exposes invoice retrieval, administrative reconciliation actions (out-of-band payment and cancellation), and the hosted invoice page — the public link that an anonymous payer opens to pay via PIX, boleto, or card.
All authenticated endpoints use the
x-api-key header (see Authentication). Endpoints under /public/invoices/* are public — the credential is possession of the high-entropy token generated when the invoice is issued. Monetary values are always integers in cents (e.g., 18990 = R$ 189.90).Endpoints
| Method | Route | Description |
|---|---|---|
GET | /invoices | List invoices with filters and pagination |
GET | /invoices/:id | Retrieve an invoice |
GET | /invoices/:id/line-items | List the line items of an invoice |
POST | /admin/invoices/:id/mark-paid-out-of-band | Reconcile a payment made outside the gateway |
POST | /admin/invoices/:id/void | Cancel (void) an invoice before payment |
GET | /public/invoices/:token | (Public) Retrieve the invoice for the hosted page |
POST | /public/invoices/:token/pay | (Public) Generate the PIX/boleto slip |
POST | /public/invoices/:token/pay-card | (Public) Charge the invoice with a tokenized card |
Invoice statuses
The invoicestatus field follows this lifecycle:
| Status | Meaning |
|---|---|
scheduled | Created in advance; becomes active when chargeAt arrives (slip issuance deferred) |
suspended | Frozen due to a subscription pause — outside the billing cycles |
open | Active, awaiting payment (PIX/boleto slip already exists when applicable) |
paid | Fully paid |
past_due | Charge failed; undergoing retry (dunning) |
unpaid | Retries exhausted — charge abandoned |
canceled | Voided by the merchant before payment |
refunded | Refunded after payment |
Terminal statuses (
paid, canceled, refunded, unpaid) reject cancellation actions. Out-of-band reconciliation only accepts invoices in open, past_due, or unpaid.List invoices
Filter by one or more statuses. Accepts CSV (
status=open,past_due) or repeated params (status=open&status=past_due). Values: scheduled, suspended, open, paid, past_due, unpaid, canceled, refunded.Filter invoices belonging to a specific subscription.
Filter invoices belonging to a specific customer.
Filter by payment method (CSV or repeated). Values:
card, pix, boleto, other.Free-text search by customer name, email, document, or invoice code (prefix).
Partial search by the formatted invoice number (e.g.,
2026-0007, 2026-, 42). Max 20 characters.Partial search by customer name, email, or document. Max 255 characters.
Minimum invoice total, in cents.
Maximum invoice total, in cents.
Date field to apply
dateFrom/dateTo against. Values: issued, due, paid, created, charge.Start of the date range. ISO 8601 with timezone (e.g.,
2026-06-01T00:00:00-03:00) or a plain date (2026-06-01).End of the date range. Same format as
dateFrom.Sort field. Values:
createdAt (default), dueAt, code, customer, paidAt, value.Sort direction:
asc or desc (default).Pagination page number.
Items per page.
The exact pagination envelope format follows the API conventions — see Conventions.
Retrieve an invoice
Invoice ID (prefix
inv_).Invoice ID (
inv_).Invoice number:
{ year, sequence }. Unique and sequential per company/year.Current status (see the status table).
Invoice nature:
enrollment (sign-up fee), recurring (regular cycle), or manual (one-off). Immutable.Customer ID (
cust_).Customer name (snapshot).
Customer email (snapshot).
Customer document (snapshot).
3-letter ISO currency code (e.g.,
BRL).Source subscription (
sub_), when applicable.When the invoice leaves
scheduled and becomes payable. ISO 8601.Due date. ISO 8601.
Issue date. ISO 8601.
Payment date. ISO 8601.
Cancellation date. ISO 8601.
Sum of line items, in cents.
Total taxes, in cents.
Total invoice amount, in cents.
Amount already paid, in cents.
Remaining amount due, in cents.
Cumulative amount refunded, in cents.
Card installments for the charge (1–12; 1 = full payment).
Start of the service period. Null for
kind=manual. ISO 8601.End of the service period. Null for
kind=manual. ISO 8601.Creation date. ISO 8601.
Last updated date. ISO 8601.
200— invoice found404— invoice not found
List line items
Returns the line items (billing lines) of an invoice.Invoice ID (
inv_).Item type:
subscription, proration, one_time, or metered_usage.Quantity.
Unit price, in cents.
Total amount for the item, in cents.
Reconcile an out-of-band payment
Marks the invoice aspaid when payment was received outside the gateway (bank transfer, cash, check). Does not go through the gateway. Accepts invoices in open, past_due, or unpaid.
This endpoint is idempotent: send the Idempotency-Key header to prevent reprocessing on retries. See Conventions.
Invoice ID (
inv_).Amount received, in cents. Positive integer.
Off-channel payment method:
bank_transfer, cash, check, or other.Date and time of receipt, ISO 8601 in UTC (with
Z suffix, e.g., 2026-06-22T17:30:00.000Z). Optional.Free-form note (max 500 characters). Optional.
200— invoice updated (status=paid)409— invoice is in a terminal status (reconciliation not allowed)
Cancel (void) an invoice
Cancels an invoice before payment. Acceptsscheduled, open, or past_due. Terminal statuses and unpaid are rejected. Both reason and reasonDetails are required.
This endpoint is idempotent: send the Idempotency-Key header.
Invoice ID (
inv_).Cancellation reason:
duplicate, wrong_amount, customer_agreement, issued_by_mistake, or other.Reason details (1 to 500 characters).
200— invoice canceled (status=canceled)409— invoice is in a terminal/unpaid status (cancellation not allowed)
Hosted invoice page (public)
Instead of emailing a PIX/boleto slip (which expires), Z2Pay generates a hosted invoice link in the format/i/{token}. The anonymous payer opens the link and the slip is generated on demand. These endpoints do not use x-api-key — the credential is possession of the token (generated at issuance, high entropy). They are rate-limited to prevent abuse.
The
token is the invoice’s public_access_token. The page polls the GET endpoint to display the slip and detect payment (the invoice transitions from open to paid).Retrieve the invoice for payment
Returns the safe invoice data (without internal IDs or sensitivecompanyId) and the current slip, if already generated.
Public invoice token.
Slip for the pending charge attempt.
null while not yet generated. When present, contains paymentMethod, status, pixUrl, pixCopyPaste, boletoUrl, boletoDigitableLine, boletoBarcode, and expiresAt.Methods allowed for this invoice.
null = no restriction (the page decides based on the subscription’s default method).Card installment configuration:
{ maxInstallments, freeInstallments?, interestRate? }. null = full payment only.200 (invoice view), 404 (invalid token).
Generate the PIX/boleto slip
Ensures a valid slip for the invoice. The request body is optional: themethod field forces PIX or boleto (among the allowed methods). Without method, the subscription’s default is used.
Public invoice token.
pix or boleto. Optional.GET above. The slip may take ~1–2s to appear (async persistence) — the page should keep polling the GET endpoint.
Declared statuses: 200 (view, slip may not be populated yet), 404 (invalid token), 409 (method not allowed for this invoice).
Charge with a tokenized card
Charges the invoice with a card tokenized by the Tokenizer on the front end (can be a third-party card). Eager charge — the result is reflected in theGET on the next poll.
Public invoice token.
Card token issued by the tokenizer.
Number of installments chosen by the payer (1 to 12; 1 = full payment). Optional.
200 (updated view), 404 (invalid token), 409 (card not allowed or invoice not payable).
Actions available in the dashboard
Some invoice operations — create a one-off invoice, generate a payment link, reschedule, and force a new charge (retry) — are performed through the merchant dashboard (user session) and are not exposed in the public API viax-api-key. The payloads below document these data shapes for reference.
Create a one-off invoice (manual)
Create a one-off invoice (manual)
Creates an ad-hoc charge tied to a subscription, outside the recurring cycle. Body:
subscriptionId(string, required)description(string, 1–200, required)amount(integer in cents, positive, required) — unit pricequantity(positive integer, default1)dueAt(ISO 8601, required, strictly in the future)reason(required):extra_service,adjustment,penalty,ad_hoc, orotherreasonDetails(string, 1–500, required)allowedPaymentMethods(array ofcard/pix/boleto, 1–3 items, optional) — methods offered on the hosted pageinstallmentsConfig(object, optional/null):{ maxInstallments (1-12), freeInstallments? (1-12), interestRate? (0-100) }.freeInstallmentscannot exceedmaxInstallments.
kind=manual, without a service period (periodStart/periodEnd are null).Generate a payment link
Generate a payment link
Transitions a
scheduled invoice to open before its chargeAt and makes the hosted page link available. No charge is executed — the payer chooses the method when opening the link. Body:methods(array ofcard/pix/boleto, 1–3 items, required) — methods offered on the pageinstallmentsConfig(object, optional/null, same shape as the one-off invoice)
Reschedule an invoice
Reschedule an invoice
Changes the charge date (
chargeAt) of a scheduled invoice. The dueAt shifts by the same interval. Body:chargeAt(ISO 8601, required)
Force a new charge (retry)
Force a new charge (retry)
Triggers a new charge attempt on an
open/past_due invoice without waiting for the dunning cycle. No body required. See Cycles.See also
Subscriptions
Create and manage the contracts that generate invoices.
Billing cycles
How each cycle issues an invoice and the dunning flow.
Plans and pricing
Define the values that make up invoice line items.
Tokenizer
Tokenize cards on the front end for the hosted invoice page.

