Customers

A customer is a person or business that buys from you. It holds their contact details and saved payment methods, and ties together their payments, invoices and subscriptions.

The Customer object

Name
object
Type
"customer",
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
balance
Type
integer,
Description
The customer's balance in cents: credit when positive, owed when negative. It's applied to the customer's invoices when they're finalized.
Name
default_payment_method
Type
string or null,
Description
The payment method charged for the customer's invoices and subscriptions that don't set their own default_payment_method.
Name
deleted
Type
boolean,
Description
Whether the customer has been deleted.
Name
email
Type
string or null,
Description
The customer's email address.
Name
external_sync
Type
object or null,
Description
The customer's record in a connected accounting system.
Properties
Name
metadata
Type
object,
Description
Your own key-value data on the object.
Name
name
Type
string or null,
Description
The customer's full name or business name.
Name
phone
Type
string or null,
Description
The customer's phone number.
Name
shipping_details
Type
object or null,
Description
The customer's saved shipping recipient and address.
Properties
Name
updated_at
Type
integer,
Description
When the object was last updated, in milliseconds since the Unix epoch.

The Customer object

{
  "object": "customer",
  "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "live": false,
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "deleted": false,
  "name": "John Doe",
  "email": "john@bias.dev",
  "phone": "+14155550123",
  "shipping_details": null,
  "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "balance": 0,
  "external_sync": null,
  "metadata": {}
}

Get a customer

Retrieve a customer by their ID.

Required parameters

Name
id
Type
string,
Description
The ID of the customer to retrieve.

Returns

Returns the customer object.

Get a customer

const customer = await bias.customers.get("id");

Response example

{
  "object": "customer",
  "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "live": false,
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "deleted": false,
  "name": "John Doe",
  "email": "john@bias.dev",
  "phone": "+14155550123",
  "shipping_details": null,
  "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "balance": 0,
  "external_sync": null,
  "metadata": {}
}

List all customers

Retrieve a paginated list of customers.

Optional parameters

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 customer objects.

List all customers

const customer = await bias.customers.list();

Response example

{
  "object": "list",
  "items": [
    {
      "object": "customer",
      "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
      "live": false,
      "created_at": 1750000000000,
      "updated_at": 1750000000000,
      "deleted": false,
      "name": "John Doe",
      "email": "john@bias.dev",
      "phone": "+14155550123",
      "shipping_details": null,
      "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
      "balance": 0,
      "external_sync": null,
      "metadata": {}
    }
  ],
  "has_more": true
}

Create a customer

Create a new customer.

Optional parameters

Name
name
Type
string or null,
Description
The customer's full name or business name.
Name
email
Type
string or null,
Description
The customer's email address.
Name
phone
Type
string or null,
Description
The customer's phone number.
Name
shipping_details
Type
object or null,
Description
The customer's saved shipping recipient and address.
Properties
Name
default_payment_method
Type
string or null,
Description
The payment method charged for the customer's invoices and subscriptions that don't set their own default_payment_method. An unattached payment method is attached to the customer.
Name
metadata
Type
object or null,
Description
Your own key-value data on the object.

Returns

Returns the customer object.

Create a customer

const customer = await bias.customers.create({
  name: "John Doe",
  email: "john@bias.dev"
});

Response example

{
  "object": "customer",
  "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "live": false,
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "deleted": false,
  "name": "John Doe",
  "email": "john@bias.dev",
  "phone": "+14155550123",
  "shipping_details": null,
  "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "balance": 0,
  "external_sync": null,
  "metadata": {}
}

Update a customer

Updates change a customer’s contact details, shipping details, default payment method or metadata.

Setting a default_payment_method charges the customer’s unpaid invoices that are waiting for a payment method right away.

Required parameters

Name
id
Type
string,

Optional parameters

Name
name
Type
string or null,
Description
The customer's full name or business name.
Name
email
Type
string or null,
Description
The customer's email address.
Name
phone
Type
string or null,
Description
The customer's phone number.
Name
shipping_details
Type
object or null,
Description
The customer's saved shipping recipient and address.
Properties
Name
default_payment_method
Type
string or null,
Description
The payment method charged for the customer's invoices and subscriptions that don't set their own default_payment_method. An unattached payment method is attached to the customer.
Name
metadata
Type
object or null,
Description
Your own key-value data on the object.

Returns

Returns the customer object.

Update a customer

const customer = await bias.customers.update("id", {
  email: "john.doe@bias.dev",
  phone: "+14155550123"
});

Response example

{
  "object": "customer",
  "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "live": false,
  "created_at": 1750000000000,
  "updated_at": 1750000000000,
  "deleted": false,
  "name": "John Doe",
  "email": "john@bias.dev",
  "phone": "+14155550123",
  "shipping_details": null,
  "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "balance": 0,
  "external_sync": null,
  "metadata": {}
}

Delete a customer

Deleting a customer is permanent and cancels their subscriptions immediately.

Required parameters

Name
id
Type
string,

Returns

A deleted object stub.

Delete a customer

const customer = await bias.customers.delete("id");

Response example

{
  "object": "customer",
  "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "deleted": true
}