Docs

The Customer object

This object represents a customer of your business. Use it to create recurring subscriptions, save wallet and contact information, and track USDC payments that belong to the same customer.

Attributes

id string

Unique identifier for the object. Zoneless customer IDs are prefixed with cus_z_.

addressnullable object

The customer's address.

balance number

The current balance, if any, that's stored on the customer in their default currency. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that's added to their next invoice. The balance only considers amounts that Zoneless hasn't successfully applied to any invoice. It doesn't reflect unpaid invoices. This balance is only taken into account after invoices finalize. For multi-currency balances, see invoice_credit_balance.

created timestamp

Time at which the object was created. Measured in seconds since the Unix epoch.

currencynullable string

Three-letter ISO code for the currency the customer can be charged in for recurring billing purposes.

Difference from Stripe: Zoneless only settles in usdc, so this field is either null or usdc.

default_sourcenullable string Expandable This can be expanded into an object with the expand request parameter.

ID of the default payment source for the customer. If you use payment methods created through the PaymentMethods API, see the invoice_settings.default_payment_method field instead.

Difference from Stripe: Stripe's default source is a bank account or card ID. Zoneless's default source is a linked Solana wallet ID (src_z_ prefix).

delinquentnullable boolean

Tracks the most recent state change on any invoice belonging to the customer. Paying an invoice or marking it uncollectible via the API sets this field to false. An automatic payment failure or passing the invoice's due_date sets this field to true.

descriptionnullable string

An arbitrary string attached to the object. Often useful for displaying to users.

discountnullable object

Describes the current discount active on the customer, if there is one.

emailnullable string

The customer's email address.

invoice_prefixnullable string

The prefix for the customer used to generate unique invoice numbers.

invoice_settings object

The customer's default invoice settings.

metadata object

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.

namenullable string

The customer's full name or business name.

next_invoice_sequencenullable number

The suffix of the customer's next invoice number (for example, 0001). When the account uses account level sequencing, this parameter is ignored in API requests and the field is omitted in API responses.

phonenullable string

The customer's phone number.

preferred_localesnullable array of strings

The customer's preferred locales (languages), ordered by preference.

shippingnullable object

Mailing and shipping address for the customer. Appears on invoices emailed to this customer.

sourcesnullable object

The customer's payment sources, if any.

Difference from Stripe: Zoneless customers pay from linked Solana wallets rather than bank accounts, so each item in sources.data represents a wallet rather than a bank account. See External Wallets for the equivalent object sellers use to receive USDC payouts.

subscriptionsnullable object

The customer's current subscriptions, if any.

tax_exemptnullable enum

Describes the customer's tax exemption status, which is none, exempt, or reverse. When set to reverse, invoice and receipt PDFs include the text "Reverse charge".

Possible enum values
exempt
none
reverse
tax_idsnullable object

The customer's tax IDs.

test_clocknullable string

ID of the test clock that this customer belongs to.

More attributes

THE CUSTOMER OBJECT
{
  "id": "cus_z_NffrFeUfNV2Hib",
  "object": "customer",
  "address": null,
  "balance": 0,
  "created": 1778894772,
  "currency": null,
  "default_source": null,
  "delinquent": false,
  "description": null,
  "email": "tomjones@example.com",
  "invoice_prefix": "024A99CD",
  "invoice_settings": {
    "custom_fields": null,
    "default_payment_method": null,
    "footer": null,
    "rendering_options": null
  },
  "livemode": false,
  "metadata": {},
  "name": "Tom Jones",
  "next_invoice_sequence": 1,
  "phone": null,
  "preferred_locales": [],
  "shipping": null,
  "tax_exempt": "none",
  "test_clock": null,
  "platform_account": "acct_z_Platform123abc"
}

Create a customer

Creates a new customer object.

ENDPOINTS
POST /v1/customers

Parameters

address object

The customer's address. Recommended if you plan to calculate tax for this customer.

balance integer

An integer amount in the smallest currency unit that represents the customer's current balance, which affects the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice. For USDC, this is cents (e.g., 100 = $1 USDC).

description string

An arbitrary string that you can attach to a customer object. It's displayed alongside the customer in the dashboard.

email string

Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. The maximum length is 512 characters.

invoice_prefix string

The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.

invoice_settings object

Default invoice settings for this customer.

metadata object

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.

name string

The customer's full name or business name. The maximum length is 256 characters.

next_invoice_sequence integer

The sequence to be used on the customer's next invoice. Defaults to 1.

payment_method string

The ID of the payment method to attach to the customer.

phone string

The customer's phone number. The maximum length is 20 characters.

preferred_locales array of strings

Customer's preferred languages, ordered by preference.

shipping object

The customer's shipping information. Appears on invoices emailed to this customer.

tax_exempt enum

The customer's tax exemption. One of none, exempt, or reverse.

Possible enum values
exempt
none
reverse

More attributes

Returns

Returns the Customer object after successful customer creation. Raises an error if create parameters are invalid (for example, specifying an invalid source).

POST/v1/customers
import { Zoneless } from '@zoneless/node';
const zoneless = new Zoneless('sk_live_z_YOUR_API_KEY', 'https://api.zoneless.com');

const customer = await zoneless.customers.create({
  name: 'Tom Jones',
  email: 'tomjones@example.com',
});
RESPONSE
{
  "id": "cus_z_NffrFeUfNV2Hib",
  "object": "customer",
  "address": null,
  "balance": 0,
  "created": 1778894772,
  "currency": null,
  "default_source": null,
  "delinquent": false,
  "description": null,
  "email": "tomjones@example.com",
  "invoice_prefix": "024A99CD",
  "invoice_settings": {
    "custom_fields": null,
    "default_payment_method": null,
    "footer": null,
    "rendering_options": null
  },
  "livemode": false,
  "metadata": {},
  "name": "Tom Jones",
  "next_invoice_sequence": 1,
  "phone": null,
  "preferred_locales": [],
  "shipping": null,
  "tax_exempt": "none",
  "test_clock": null,
  "platform_account": "acct_z_Platform123abc"
}

Update a customer

Updates the specified customer by setting the values of the parameters passed. Any parameters not provided are left unchanged.

ENDPOINTS
POST /v1/customers/:id

Parameters

address object

The customer's address. Recommended if you plan to calculate tax for this customer.

balance integer

An integer amount in the smallest currency unit that represents the customer's current balance, which affects the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.

default_source string

If you're using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method parameter instead.

Provide the ID of a payment source already attached to this customer to make it this customer's default payment source.

If you want to add a new payment source and make it the default, see the source property. The maximum length is 500 characters.

description string

An arbitrary string that you can attach to a customer object. It's displayed alongside the customer in the dashboard.

email string

Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. The maximum length is 512 characters.

invoice_prefix string

The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.

invoice_settings object

Default invoice settings for this customer.

metadata object

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.

name string

The customer's full name or business name. The maximum length is 256 characters.

next_invoice_sequence integer

The sequence to be used on the customer's next invoice. Defaults to 1.

phone string

The customer's phone number. The maximum length is 20 characters.

preferred_locales array of strings

Customer's preferred languages, ordered by preference.

shipping object

The customer's shipping information. Appears on invoices emailed to this customer.

tax_exempt enum

The customer's tax exemption. One of none, exempt, or reverse.

Possible enum values
exempt
none
reverse

More attributes

Returns

Returns the Customer object if the update succeeded. Raises an error if update parameters are invalid (for example, specifying an invalid source).

POST/v1/customers/:id
import { Zoneless } from '@zoneless/node';
const zoneless = new Zoneless('sk_live_z_YOUR_API_KEY', 'https://api.zoneless.com');

const customer = await zoneless.customers.update('cus_z_NffrFeUfNV2Hib', {
  metadata: {
    order_id: '6735',
  },
});
RESPONSE
{
  "id": "cus_z_NffrFeUfNV2Hib",
  "object": "customer",
  "address": null,
  "balance": 0,
  "created": 1778894772,
  "currency": null,
  "default_source": null,
  "delinquent": false,
  "description": null,
  "email": "tomjones@example.com",
  "invoice_prefix": "024A99CD",
  "invoice_settings": {
    "custom_fields": null,
    "default_payment_method": null,
    "footer": null,
    "rendering_options": null
  },
  "livemode": false,
  "metadata": {
    "order_id": "6735"
  },
  "name": "Tom Jones",
  "next_invoice_sequence": 1,
  "phone": null,
  "preferred_locales": [],
  "shipping": null,
  "tax_exempt": "none",
  "test_clock": null,
  "platform_account": "acct_z_Platform123abc"
}

Retrieve a customer

Retrieves a Customer object.

ENDPOINTS
GET /v1/customers/:id

Parameters

No parameters.

Returns

Returns the Customer object for a valid identifier. If it's for a deleted customer, a subset of the customer's information is returned, including a deleted property that's set to true.

GET/v1/customers/:id
import { Zoneless } from '@zoneless/node';
const zoneless = new Zoneless('sk_live_z_YOUR_API_KEY', 'https://api.zoneless.com');

const customer = await zoneless.customers.retrieve('cus_z_NffrFeUfNV2Hib');
RESPONSE
{
  "id": "cus_z_NffrFeUfNV2Hib",
  "object": "customer",
  "address": null,
  "balance": 0,
  "created": 1778894772,
  "currency": null,
  "default_source": null,
  "delinquent": false,
  "description": null,
  "email": "tomjones@example.com",
  "invoice_prefix": "024A99CD",
  "invoice_settings": {
    "custom_fields": null,
    "default_payment_method": null,
    "footer": null,
    "rendering_options": null
  },
  "livemode": false,
  "metadata": {},
  "name": "Tom Jones",
  "next_invoice_sequence": 1,
  "phone": null,
  "preferred_locales": [],
  "shipping": null,
  "tax_exempt": "none",
  "test_clock": null,
  "platform_account": "acct_z_Platform123abc"
}

List all customers

Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.

ENDPOINTS
GET /v1/customers

Parameters

email string

A case-sensitive filter on the list based on the customer's email field. The value must be a string. The maximum length is 512 characters.

test_clock string

Provides a list of customers that are associated with the specified test clock. The response won't include customers with test clocks if this parameter isn't set.

More attributes

Returns

A dictionary with a data property that contains an array of up to limit customers, starting after customer starting_after. Passing an optional email results in filtering to customers with only that exact email address. Each entry in the array is a separate customer object. If no more customers are available, the resulting array is empty.

GET/v1/customers
import { Zoneless } from '@zoneless/node';
const zoneless = new Zoneless('sk_live_z_YOUR_API_KEY', 'https://api.zoneless.com');

const customers = await zoneless.customers.list({
  limit: 3,
});
RESPONSE
{
  "object": "list",
  "url": "/v1/customers",
  "has_more": false,
  "data": [
    {
      "id": "cus_z_NffrFeUfNV2Hib",
      "object": "customer",
      "address": null,
      "balance": 0,
      "created": 1778894772,
      "currency": null,
      "default_source": null,
      "delinquent": false,
      "description": null,
      "email": "tomjones@example.com",
      "invoice_prefix": "024A99CD",
      "invoice_settings": {
        "custom_fields": null,
        "default_payment_method": null,
        "footer": null,
        "rendering_options": null
      },
      "livemode": false,
      "metadata": {},
      "name": "Tom Jones",
      "next_invoice_sequence": 1,
      "phone": null,
      "preferred_locales": [],
      "shipping": null,
      "tax_exempt": "none",
      "test_clock": null,
      "platform_account": "acct_z_Platform123abc"
    }
  ]
}

Delete a customer

Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.

ENDPOINTS
DELETE /v1/customers/:id

Parameters

No parameters.

Returns

Returns an object with a deleted parameter on success. If the customer ID does not exist, this call raises an error.

Unlike other objects, deleted customers can still be retrieved through the API in order to be able to track their history. Deleting customers removes all wallet details and prevents any further operations to be performed (such as adding a new subscription).

DELETE/v1/customers/:id
import { Zoneless } from '@zoneless/node';
const zoneless = new Zoneless('sk_live_z_YOUR_API_KEY', 'https://api.zoneless.com');

const deleted = await zoneless.customers.del('cus_z_NffrFeUfNV2Hib');
RESPONSE
{
  "id": "cus_z_NffrFeUfNV2Hib",
  "object": "customer",
  "deleted": true
}