Create Invoice
Create a new invoice.
Supports two invoice types:
- “one_off”: Manual invoice, items must be provided explicitly, no subscription_id allowed
- “recurring”: Subscription-attached invoice; items must be provided explicitly (empty items 422s). Floating items are swept in only at subscription renewal, not at create time.
An optional processor_route_id pins a route to the invoice’s card charges.
A route that cannot be used is not pinned and the invoice is still created;
routing in the response says why.
Works for both User and API Key authentication. Account access is automatically validated via endpoint dependency.
Authentication
Bearer authentication of the form Bearer <token>, where token is your auth token.
Path parameters
Headers
Request
Why an invoice exists. Re-exported from invoices_schemas for
backwards compatibility — new code should import it from here.
Lives in this dependency-free module, rather than in invoices_schemas,
because the payments side needs it too: payment_intents snapshots the
producing invoice’s reason (see PaymentIntentEntity.invoice_billing_reason)
and importing invoices_schemas from intents_model would drag half of
billing into the payments import graph. Same reasoning that moved the
PaymentIntent enums into intents_enums.
Optional free-text note to attach to the invoice. Merchant-private: unlike description it never appears on the invoice PDF. Use PATCH /invoices/{id} to edit or clear it later.
Number of days after the invoice’s creation date that it is due. Overrides due_date if provided. When neither net_d nor due_date is set, a send_invoice invoice is due 30 days after its creation date and a charge_automatically invoice on issued_at. The creation date is when the API creates the invoice, not issued_at.
When true, the ‘Pay online’ link is rendered on the invoice PDF and in-app preview.
Processor route to pin to this invoice. While the account’s routing engine is enabled and the route applies, it overrides the subscription’s pinned route (for an invoice of a subscription), routing rules and the account default for every card charge of this invoice: POST /invoices/{id}/collect, a payment from the customer portal and dunning retries. It applies only to card payment methods. Each of those collections first checks the route against the cards it would try, in order: when it would charge none of them through the route (for example, none is saved on an active processor the route names that supports the invoice currency, or a card it reaches first cannot be charged at all under the route), the route does not apply to that collection, whose charges route as if no route had been named, and the collect response’s routing gives fallback_reason route_cannot_charge_card and fallback_detail. When it would reach a card the route can charge, the route applies. A route whose effect depends on the payment (conditions, a weighted split over routes) is not checked. Except in a collection the route does not apply to, engine on or off, the invoice’s card charges never fall back to a network-token charge on a processor outside the route. Set only here: it cannot be changed or removed later. Setting it needs the routing_rule:edit permission (dashboard users; API keys always may). A route that cannot be used is not pinned, and the invoice is still created: its charges route as if no route had been named (the subscription’s pinned route, if any, then the account’s routing rules, then the account default), and the response’s routing object gives fallback_reason and fallback_detail. That happens when the route is not an active route of this account (route_not_found, route_inactive) or when it stops every payment (route_stops_every_payment). Create does not check the route against the customer’s payment methods, because collect can charge another one (payment_method_id). POST /invoices/preview ignores it.
Response
Custom field values. Only included when expand=custom_fields is specified.
Free-text note attached to this invoice, from the notes side-table. Merchant-private — unlike description, it never appears on the invoice PDF or any customer-facing surface.
Why an invoice exists. Re-exported from invoices_schemas for
backwards compatibility — new code should import it from here.
Lives in this dependency-free module, rather than in invoices_schemas,
because the payments side needs it too: payment_intents snapshots the
producing invoice’s reason (see PaymentIntentEntity.invoice_billing_reason)
and importing invoices_schemas from intents_model would drag half of
billing into the payments import graph. Same reasoning that moved the
PaymentIntent enums into intents_enums.
False when the checkout session that created this invoice opted out of the customer’s credit balance (no credit applied; a debt is still settled).
The processor route pinned to this invoice at create (processor_route_id on POST /invoices), or null when none is. While the account’s routing engine is on and the route is active, the invoice’s card charges go through it, ahead of the subscription’s pinned route, routing rules and the account default. A collection that would charge none of its cards through it routes as if the invoice had no route.
What became of the requested processor_route_id: pinned, or not pinned and why (the invoice’s charges then route as if no route had been named). Create charges nothing, so charge_route_id is null. Present only when the request named a route.