Create an invoice
POST / v1 / invoices
This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you finalize the invoice, which allows you to pay or send the invoice to your customers.
Parameters
- auto _ advance boolean Controls whether Stripe performs automatic collection of the invoice. If
false, the invoice’s state doesn’t automatically advance without an explicit action. Defaults to false. - automatic _ tax object Settings for automatic tax lookup for this invoice.
- collection _ method enum Either
charge_automatically, orsend_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. Defaults tocharge_automatically. Possible enum valuescharge_automaticallysend_invoice - customer string Required unless from_invoice is provided The ID of the customer to bill.
- customer _ account string The ID of the account to bill.
- description string An arbitrary string attached to the object. Often useful for displaying to users. Referenced as ‘memo’ in the Dashboard.
- metadata map Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata. - subscription string The ID of the subscription to invoice, if any. If set, the created invoice will only include pending invoice items for that subscription. The subscription’s billing cycle and regular subscription events won’t be affected.
More parameters
- account _ tax _ ids array of strings
- application _ fee _ amount integer Connect only
- automatically _ finalizes _ at timestamp
- currency enum
- custom _ fields array of objects
- days _ until _ due integer
- default _ payment _ method string
- default _ source string
- default _ tax _ rates array of strings
- discounts array of objects
- due _ date timestamp
- effective _ at timestamp
- footer string
- from _ invoice object Required unless customer is provided
- issuer object Connect only
- number string
- on _ behalf _ of string Connect only
- payment _ settings object
- pending _ invoice _ items _ behavior enum
- rendering object
- shipping _ cost object
- shipping _ details object
- statement _ descriptor string
- transfer _ data object Connect only
Returns
Returns the invoice object. Raises an error if the customer ID provided is invalid.
Response
Update an invoice
POST / v1 / invoices /:id
Draft invoices are fully editable. Once an invoice is finalized, monetary values, as well as collection_method, become uneditable.
If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on, sending reminders for, or automatically reconciling invoices, pass auto_advance=false.
Parameters
- auto _ advance boolean Controls whether Stripe performs automatic collection of the invoice.
- automatic _ tax object Settings for automatic tax lookup for this invoice.
- collection _ method enum Either
charge_automaticallyorsend_invoice. This field can be updated only ondraftinvoices. Possible enum valuescharge_automaticallysend_invoice - description string An arbitrary string attached to the object. Often useful for displaying to users. Referenced as ‘memo’ in the Dashboard.
- metadata map Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata.
More parameters
- account _ tax _ ids array of strings
- application _ fee _ amount integer Connect only
- automatically _ finalizes _ at timestamp
- custom _ fields array of objects
- days _ until _ due integer
- default _ payment _ method string
- default _ source string
- default _ tax _ rates array of strings
- discounts array of objects
- due _ date timestamp
- effective _ at timestamp
- footer string
- issuer object Connect only
- number string
- on _ behalf _ of string Connect only
- payment _ settings object
- rendering object
- shipping _ cost object
- shipping _ details object
- statement _ descriptor string
- transfer _ data object Connect only
Returns
Returns the invoice object.
Response
Retrieve an invoice
GET / v1 / invoices /:id
Retrieves the invoice with the given ID.
Parameters
No parameters.
Returns
Returns an invoice object if a valid invoice ID was provided. Raises an error otherwise.
The invoice object contains a lines hash that contains information about the subscriptions and invoice items that have been applied to the invoice, as well as any prorations that Stripe has automatically calculated. Each line on the invoice has an amount attribute that represents the amount actually contributed to the invoice’s total. For invoice items and prorations, the amount attribute is the same as for the invoice item or proration respectively. For subscriptions, the amount may be different from the plan’s regular price depending on whether the invoice covers a trial period or the invoice period differs from the plan’s usual interval.
The invoice object has both a subtotal and a total. The subtotal represents the total before any discounts, while the total is the final amount to be charged to the customer after all coupons have been applied.
The invoice also has a next_payment_attempt attribute that tells you the next time (as a Unix timestamp) payment for the invoice will be automatically attempted. For invoices with manual payment collection, that have been closed, or that have reached the maximum number of retries (specified in your subscriptions settings), the next_payment_attempt will be null.
Response
