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
true if the object is live, or false if 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: total less balance_applied and 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_billed less succeeded and processing payments. 0 unless the invoice is draft or open.
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_method is 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
footer
Type
string or null,
Description
Footer text displayed on the invoice.
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

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

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

const invoice = await bias.invoices.get("id");

Response example

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

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
Filters for the list, combined with and and or.
Properties

Returns

Returns a list of invoice objects.

List all invoices

const invoice = await bias.invoices.list();

Response example

{
  "object": "list",
  "items": [
    {
      "object": "invoice",
      "live": false,
      "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "billing_address": {
        "line1": "123 Hope St",
        "line2": null,
        "city": "Los Angeles",
        "state": "CA",
        "postal_code": "90071",
        "country": "US"
      },
      "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
      "due_at": 1750086400000,
      "days_until_due": null,
      "payments": null,
      "line_items": [
        {
          "object": "line_item",
          "id": "li_rbw8iroSXBkFMZ8bisSxK",
          "live": false,
          "created_at": 1750000000000,
          "updated_at": 1750000000000,
          "type": "catalog",
          "quantity": 2,
          "name": null,
          "description": null,
          "unit_amount": 1000,
          "price": "price_dz1NVvl5CSogERkeA9Ng67",
          "product": "prod_KDCnId9DMZSOA9MSaut4Q",
          "discounts": [],
          "taxes": [],
          "tax_amounts": [],
          "subtotal": 2000,
          "total": 2000,
          "period": null,
          "subscription_item": null
        }
      ],
      "discounts": [],
      "metadata": {},
      "number": "INV-001",
      "shipping_details": {
        "name": "John Doe",
        "phone": "+1 (555) 123-4567",
        "address": {
          "line1": "123 Hope St",
          "line2": null,
          "city": "Los Angeles",
          "state": "CA",
          "postal_code": "90071",
          "country": "US"
        }
      },
      "status": "open",
      "collection_method": "send_invoice",
      "subscription": null,
      "billing_reason": "manual",
      "default_payment_method": null,
      "attempt_count": 0,
      "next_attempt_at": null,
      "default_taxes": [],
      "subtotal": 2000,
      "tax_total": 0,
      "total": 2000,
      "amount_billed": 2000,
      "balance_applied": 0,
      "amount_paid": 0,
      "amount_remaining": 2000,
      "external_sync": null,
      "attachments": [],
      "credit_notes": null,
      "memo": null,
      "footer": null,
      "custom_fields": null,
      "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
    }
  ],
  "has_more": true
}

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_method is 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

const invoice = await bias.invoices.create({
  customer: "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  line_items: [
    {
      price: "price_dz1NVvl5CSogERkeA9Ng67",
      quantity: 2
    },
    {
      price_data: {
        product: "prod_KDCnId9DMZSOA9MSaut4Q",
        unit_amount: 4500
      },
      quantity: 1
    },
    {
      price_data: {
        name: "Custom service",
        unit_amount: 1500
      },
      quantity: 1
    }
  ],
  due_at: 1750086400000
});

Response example

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

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_method is charged. Setting it on an open charge_automatically invoice 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

const invoice = await bias.invoices.update("id", {
  customer: "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  due_at: 1750172800000
});

Response example

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

Delete an invoice

Deleting permanently removes a draft invoice.

Required parameters

Name
id
Type
string,

Returns

A deleted object stub.

Delete an invoice

const invoice = await bias.invoices.delete("id");

Response example

{
  "object": "invoice",
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "deleted": true
}

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

const invoice = await bias.invoices.finalize("id");

Response example

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

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

const invoice = await bias.invoices.send("id");

Response example

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

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

const invoice = await bias.invoices.markPaid("id");

Response example

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

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

const invoice = await bias.invoices.markUncollectible("id");

Response example

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

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

const invoice = await bias.invoices.void("id");

Response example

{
  "object": "invoice",
  "live": false,
  "id": "inv_2bA3FSNtE8Qmpg2ufwPmC2",
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "billing_address": {
    "line1": "123 Hope St",
    "line2": null,
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90071",
    "country": "US"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "due_at": 1750086400000,
  "days_until_due": null,
  "payments": null,
  "line_items": [
    {
      "object": "line_item",
      "id": "li_rbw8iroSXBkFMZ8bisSxK",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "type": "catalog",
      "quantity": 2,
      "name": null,
      "description": null,
      "unit_amount": 1000,
      "price": "price_dz1NVvl5CSogERkeA9Ng67",
      "product": "prod_KDCnId9DMZSOA9MSaut4Q",
      "discounts": [],
      "taxes": [],
      "tax_amounts": [],
      "subtotal": 2000,
      "total": 2000,
      "period": null,
      "subscription_item": null
    }
  ],
  "discounts": [],
  "metadata": {},
  "number": "INV-001",
  "shipping_details": {
    "name": "John Doe",
    "phone": "+1 (555) 123-4567",
    "address": {
      "line1": "123 Hope St",
      "line2": null,
      "city": "Los Angeles",
      "state": "CA",
      "postal_code": "90071",
      "country": "US"
    }
  },
  "status": "open",
  "collection_method": "send_invoice",
  "subscription": null,
  "billing_reason": "manual",
  "default_payment_method": null,
  "attempt_count": 0,
  "next_attempt_at": null,
  "default_taxes": [],
  "subtotal": 2000,
  "tax_total": 0,
  "total": 2000,
  "amount_billed": 2000,
  "balance_applied": 0,
  "amount_paid": 0,
  "amount_remaining": 2000,
  "external_sync": null,
  "attachments": [],
  "credit_notes": null,
  "memo": null,
  "footer": null,
  "custom_fields": null,
  "payment_url": "https://invoice.biaspay.com/uEyLI6rmFylTwIBik5cpn8ge"
}

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

const invoice = await bias.invoices.pdf("id");

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.

Retrieve an invoice receipt

const invoice = await bias.invoices.receipt("id");