Invoices represent an amount due from a customer, either for a one-time charge or a subscription period. Keep a local invoice record keyed by the API invoice ID and link it to your customer, subscription, order, and line-item snapshot.

Finalize and collect

Use invoice lifecycle operations to draft, finalize, send, pay, void, and reconcile an invoice. Keep line items, tax, discounts, due dates, and customer identifiers on the invoice so your accounting and fulfillment systems have one stable record.
Finalize only after the amount and customer details are complete. Send or pay an invoice according to your collection policy. Use the hosted invoice URL for customer viewing, never expose server credentials, and do not assume that send means paid. Handle invoice events idempotently. A paid invoice can arrive after an earlier failure, and a failed invoice can be retried later. Update access and dunning state from the latest verified event. For open, past_due, or payment-failed state, provide a recovery path; for void or uncollectible, apply the policy you communicated to the customer.