Skip to main content
POST
Invoice accrued usage

Authorizations

Authorization
string
header
required

Your account's secret key: Authorization: Bearer sk_test_… or sk_live_…. Server-side only.

Body

application/json
customerId
string<uuid>
required

The product enrollment id whose usage is invoiced. Not the customer id.

from
string<date-time>
required

Start of the window (inclusive).

to
string<date-time>
required

End of the window (exclusive).

send
boolean

true emails the invoice as soon as it is created.

Response

Created.

What a customer owes: line items, totals and status. Status: draft → open → paid, or void / uncollectible.

id
string
required
Pattern: ^inv_[0-9A-Za-z]{22}$
Example:

"inv_6yi30EKotIwGHZdePSdsFc"

status
enum<string>
required

draft (being built), open (issued, awaiting payment), paid, void (canceled) or uncollectible (written off).

Available options:
draft,
pending,
open,
paid,
void,
uncollectible
currency
string
required

Currency, as an ISO 4217 code (BRL).

subtotal
string
required

Sum of line items before tax and discounts.

tax
string
required

Tax on the invoice.

total
string
required

The invoice's final amount.

amountDue
string
required

How much is still owed.

createdAt
string<date-time>
required
customerId
string<uuid> | null

The customer's product enrollment id. Set on product, usage and subscription invoices.

payerId
string | null

The paying customer's id. Set on one-off invoices.

Pattern: ^cus_[0-9A-Za-z]{22}$
Example:

"cus_6Tq0Y2rGJ1aQ9zXk3LmPbV"

subscriptionId
string | null

The subscription that generated the invoice

Pattern: ^sub_[0-9A-Za-z]{22}$
Example:

"sub_2Kp7rWqT0aLm4XcVb8NzJe"

invoiceNumber
string | null

Sequential invoice number

periodStart
string<date-time> | null

Start of the billed period

periodEnd
string<date-time> | null

End of the billed period

dueDate
string<date-time> | null

Due date.

finalizedAt
string<date-time> | null

When the invoice was issued.

paidAt
string<date-time> | null

When the invoice was paid.

successUrl
string | null

Where checkout sends the buyer after payment.

cancelUrl
string | null

Where checkout sends the buyer if they back out.

lineItems
object[]