Invoices
An invoice requests payment from a customer for one or more line items. With charge_automatically, Bias charges the customer’s saved payment method. With send_invoice, the customer pays on the invoice’s payment page. The invoicing guide covers statuses, credit notes and voiding.
The Invoice object
- Name
object
- Type
- "invoice",
- Description
- The object's type.
- Name
id
- Type
- string,
- Description
- Unique identifier for the object.
- Name
live
- Type
- boolean,
- Description
trueif the object is live, orfalseif it's in a sandbox.
- Name
created_at
- Type
- integer,
- Description
- When the object was created, in milliseconds since the Unix epoch.
- Name
amount_billed
- Type
- integer,
- Description
- What the invoice bills:
totallessbalance_appliedand credit notes'pre_payment_amount.
- Name
amount_paid
- Type
- integer,
- Description
- The amount succeeded payments received. A bank debit counts once it settles.
- Name
amount_remaining
- Type
- integer, at least 0,
- Description
- What's left to pay:
amount_billedless succeeded and processing payments.0unless the invoice isdraftoropen.
- Name
attachments
- Type
- array of Files or null or null,
- Description
- Expandable. Files related to the invoice that are shown to the customer.
- Name
attempt_count
- Type
- integer,
- Description
- The number of automatic payment attempts made on the invoice.
- Name
balance_applied
- Type
- integer,
- Description
- How much of the customer's balance the invoice applied when it was finalized. Negative when it collects what the customer owed.
- Name
billing_address
- Type
- object,
- Description
- The billing address for the invoice.
- Properties
- Name
billing_reason
- Type
- enum,
- Description
- Why the invoice was created.
- Properties
- Name
collection_method
- Type
- enum,
- Description
- How the invoice is paid.
- Properties
- Name
credit_notes
- Type
- array of CreditNotes or null or null,
- Description
- Expandable. The credit notes issued against this invoice.
- Name
custom_fields
- Type
- object or null,
- Description
- Label-value pairs displayed on the invoice.
- Name
customer
- Type
- string or Customer,
- Description
- Expandable. The customer associated with the invoice.
- Name
days_until_due
- Type
- integer or null,
- Description
- The number of days after finalization that the invoice is due.
- Name
default_payment_method
- Type
- string or null,
- Description
- The saved payment method charged when the invoice is collected automatically. When null, the customer's
default_payment_methodis charged.
- Name
default_taxes
- Type
- array of objects or null,
- Description
- The default taxes used for line items without their own taxes.
- Properties
- Name
discounts
- Type
- array of AppliedDiscounts or null,
- Description
- Expandable. Discounts applied to the invoice as a whole.
- Name
due_at
- Type
- integer or null,
- Description
- The due date for the invoice as a Unix timestamp in milliseconds.
- Name
external_sync
- Type
- object or null,
- Description
- The external system record linked to this invoice, if any.
- Properties
- Name
line_items
- Type
- array of LineItems or null,
- Description
- Expandable. The line items included in this invoice.
- Name
memo
- Type
- string or null,
- Description
- A memo displayed on the invoice.
- Name
metadata
- Type
- object,
- Description
- Your own key-value data on the object.
- Name
next_attempt_at
- Type
- integer or null,
- Description
- When the next automatic payment attempt will run, as a Unix timestamp in milliseconds. Null when none is scheduled.
- Name
number
- Type
- string,
- Description
- The invoice number.
- Name
payment_url
- Type
- string or null,
- Description
- The URL of the hosted payment page for this invoice.
- Name
payments
- Type
- array of Payments or null or null,
- Description
- Expandable. The payments associated with the invoice.
- Name
shipping_details
- Type
- object,
- Description
- Where the invoice's order ships.
- Properties
- Name
status
- Type
- enum,
- Description
- The status of the invoice.
- Properties
- Name
subscription
- Type
- string or null,
- Description
- The subscription this invoice bills, if any.
- Name
subtotal
- Type
- integer,
- Description
- The amount of the invoice after discounts and before taxes.
- Name
tax_total
- Type
- integer,
- Description
- The total amount of all taxes on the invoice.
- Name
total
- Type
- integer,
- Description
- The total amount of the invoice after discounts and taxes.
- Name
updated_at
- Type
- integer,
- Description
- When the object was last updated, in milliseconds since the Unix epoch.
The Invoice object
Get an invoice
Retrieve an invoice by its ID.
Required parameters
- Name
id
- Type
- string,
- Description
- The ID of the invoice to retrieve.
Optional parameters
- Name
expand
- Type
- object,
- Properties
Returns
Returns the invoice object.
Get an invoice
Response example
List all invoices
Retrieve a paginated list of invoices, most recently created first.
Optional parameters
- Name
expand
- Type
- object,
- Description
- Related objects to expand in the response.
- Properties
- Name
ending_before
- Type
- string,
- Description
- The ID of the object to list before, for pagination.
- Name
starting_after
- Type
- string,
- Description
- The ID of the object to list after, for pagination.
- Name
limit
- Type
- integer, at least 1, at most 1000, default is 50
- Description
- The maximum number of objects to return, from 1 to 1000. Defaults to 50.
- Name
filters
- Type
- object, object, or object,
- Description
- Properties
Returns
Returns a list of invoice objects.
List all invoices
Response example
Create an invoice
A new invoice is a draft that the customer can’t see or pay until it’s finalized.
Required parameters
- Name
customer
- Type
- string,
- Description
- The customer to bill.
- Name
line_items
- Type
- array of objects,
- Description
- The line items for this invoice.
- Properties
Optional parameters
- Name
expand
- Type
- object,
- Properties
- Name
billing_address
- Type
- object or null,
- Description
- The billing address for this invoice.
- Properties
- Name
shipping_details
- Type
- object or null,
- Description
- Shipping details for this invoice.
- Properties
- Name
discounts
- Type
- array of object,
- Description
- The discounts or discount codes to apply to this invoice.
- Properties
- Name
due_at
- Type
- integer or null,
- Description
- The due date for this invoice as a Unix timestamp in milliseconds.
- Name
days_until_due
- Type
- integer or null,
- Description
- The number of days after finalization that the invoice is due.
- Name
collection_method
- Type
- enum,
- Description
- How the invoice is paid. Defaults to
send_invoice. - Properties
- Name
default_payment_method
- Type
- string or null,
- Description
- The saved payment method charged when the invoice is collected automatically. When null, the customer's
default_payment_methodis charged.
- Name
metadata
- Type
- object or null,
- Description
- Your own key-value data on the object.
- Name
attachments
- Type
- array of string or null,
- Description
- The IDs of files to attach to this invoice.
- Name
memo
- Type
- string or null,
- Description
- A memo displayed on the invoice.
- Name
footer
- Type
- string or null,
- Description
- Footer text displayed on the invoice.
- Name
custom_fields
- Type
- object or null,
- Description
- Label-value pairs displayed on the invoice.
- Name
default_taxes
- Type
- array of objects,
- Description
- The taxes applied to line items without their own.
- Properties
Returns
Returns the invoice object.
Create an invoice
Response example
Update an invoice
Anything on a draft can change. Once an invoice is finalized, only its metadata can change, and its default_payment_method while it’s open.
Required parameters
- Name
id
- Type
- string,
Optional parameters
- Name
expand
- Type
- object,
- Properties
- Name
customer
- Type
- string,
- Description
- The ID of the customer for this invoice.
- Name
billing_address
- Type
- object or null,
- Description
- The billing address for this invoice.
- Properties
- Name
shipping_details
- Type
- object or null,
- Description
- Shipping details for this invoice.
- Properties
- Name
line_items
- Type
- array of objects,
- Description
- The line items for this invoice. Replaces all existing line items.
- Properties
- Name
discounts
- Type
- array of object,
- Description
- The discounts or discount codes to apply to this invoice. Replaces the existing discounts.
- Properties
- Name
due_at
- Type
- integer or null,
- Description
- The due date for this invoice as a Unix timestamp in milliseconds.
- Name
days_until_due
- Type
- integer or null,
- Description
- The number of days after finalization that the invoice is due.
- Name
collection_method
- Type
- enum,
- Description
- How the invoice is paid.
- Properties
- Name
default_payment_method
- Type
- string or null,
- Description
- The saved payment method charged when the invoice is collected automatically. When null, the customer's
default_payment_methodis charged. Setting it on an opencharge_automaticallyinvoice charges it immediately.
- Name
metadata
- Type
- object or null,
- Description
- Your own key-value data on the object.
- Name
attachments
- Type
- array of string or null,
- Description
- The IDs of files to attach to this invoice. Replaces all existing attachments.
- Name
memo
- Type
- string or null,
- Description
- A memo displayed on the invoice.
- Name
footer
- Type
- string or null,
- Description
- Footer text displayed on the invoice.
- Name
custom_fields
- Type
- object or null,
- Description
- Label-value pairs displayed on the invoice.
- Name
default_taxes
- Type
- array of objects,
- Description
- The taxes applied to line items without their own.
- Properties
Returns
Returns the invoice object.
Update an invoice
Response example
Delete an invoice
Deleting permanently removes a draft invoice.
Required parameters
- Name
id
- Type
- string,
Returns
A deleted object stub.
Delete an invoice
Response example
Finalize an invoice
Finalizing locks a draft invoice and makes it payable. Bias applies the customer’s balance, and if nothing is left to pay, the invoice is paid.
Otherwise the invoice is open. With charge_automatically, Bias charges it right away. With send_invoice, the customer is emailed once you send it.
Required parameters
- Name
id
- Type
- string,
Returns
Returns the invoice object.
Finalize an invoice
Response example
Send an invoice
Sending emails an open invoice and its payment link to the customer.
Required parameters
- Name
id
- Type
- string,
Optional parameters
- Name
email
- Type
- string or null,
- Description
- The email address to send the invoice to. Defaults to the customer's email.
Returns
Returns the invoice object.
Send an invoice
Response example
Mark an invoice as paid
Marking a draft or open invoice paid settles it when the customer paid outside Bias, such as by check or wire.
Required parameters
- Name
id
- Type
- string,
Returns
Returns the invoice object.
Mark an invoice as paid
Response example
Mark an invoice as uncollectible
Marking an open invoice uncollectible writes it off and stops automatic payment attempts. The customer can still pay it.
Required parameters
- Name
id
- Type
- string,
Returns
Returns the invoice object.
Mark an invoice as uncollectible
Response example
Void an invoice
Voiding cancels an open or paid invoice, and can’t be undone. Card authorizations on it that are awaiting capture are canceled, and what it applied from the customer’s balance is given back.
Voiding doesn’t refund payments. To refund them, create a credit note with refund_amount.
Required parameters
- Name
id
- Type
- string,
Returns
Returns the invoice object.
Void an invoice
Response example
Retrieve an invoice PDF
Renders an invoice as a PDF.
Required parameters
- Name
id
- Type
- string,
Returns
Returns the PDF file contents.
Retrieve an invoice PDF
Retrieve an invoice receipt
Renders a PDF receipt of an invoice’s payments.
Required parameters
- Name
id
- Type
- string,
Returns
Returns the PDF file contents.