Docs

The Invoice object

Invoices are statements of amounts owed by a customer. They are generated one-off, or periodically from a subscription. They contain invoice items and proration adjustments that may be caused by subscription upgrades or downgrades. Invoices settle in USDC on Solana. If your invoice is configured for automatic collection, Zoneless finalizes the invoice and attempts payment after webhooks are delivered. If configured for send_invoice, Zoneless emails the customer with a link to the hosted invoice page. Any customer credit balance is applied before determining the amount due.

Attributes

id string

Unique identifier for the object. Zoneless invoice IDs are prefixed with in_z_.

object string

String representing the object’s type. Objects of the same type share the same value.

account_countrynullable string

The country of the business associated with this invoice, most often the business creating the invoice.

account_namenullable string

The public name of the business associated with this invoice, most often the business creating the invoice.

amount_due integer

Final amount due at this time for this invoice. If the invoice’s total is smaller than the minimum charge amount, or if there is account credit that can be applied, amount_due may be 0. The payment collected for the invoice is for this amount. For USDC, this is cents (e.g., 100 = $1 USDC).

amount_overpaid integer

Amount that was overpaid on the invoice. The amount overpaid is credited to the customer’s credit balance.

amount_paid integer

The amount, in the smallest currency unit, that was paid.

amount_remaining integer

The difference between amount_due and amount_paid, in the smallest currency unit.

attempt_count integer

Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count.

attempted boolean

Whether an attempt has been made to pay the invoice. An invoice is not attempted until after the invoice.created webhook is delivered, so you might not want to display that invoice as unpaid to your users yet.

auto_advance boolean

Controls whether Zoneless performs automatic collection of the invoice. If false, the invoice’s state doesn’t automatically advance without an explicit action.

billing_reasonnullable enum

Indicates the reason why the invoice was created.

Possible enum values
automatic_pending_invoice_item_invoice
manualUnrelated to a subscription, for example created via the API or Dashboard.
quote_accept
subscription
subscription_createA new subscription was created.
subscription_cycleA subscription advanced into a new period.
subscription_thresholdA subscription reached a billing threshold.
subscription_updateA subscription was updated.
upcoming
collection_method enum

Either charge_automatically or send_invoice. When charging automatically, Zoneless attempts to pay this invoice using the default payment method attached to the customer. When sending an invoice, Zoneless emails the customer with payment instructions.

Possible enum values
charge_automaticallyAttempt payment using the default payment method attached to the customer.
send_invoiceEmail payment instructions to the customer.
created timestamp

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

currency enum

Three-letter currency code, in lowercase. For Zoneless, this is usdc.

Difference from Stripe: Uses usdc instead of fiat currency codes like usd.

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

The ID of the customer to bill.

customer_emailnullable string

The customer’s email. Until the invoice is finalized, this field equals customer.email. Once finalized, it is no longer updated.

customer_namenullable string

The customer’s name. Until the invoice is finalized, this field equals customer.name. Once finalized, it is no longer updated.

descriptionnullable string

An arbitrary string attached to the object. Often useful for displaying to users. Referenced as “memo” in the Dashboard.

due_datenullable timestamp

The date on which payment for this invoice is due. This value is null for invoices where collection_method=charge_automatically.

hosted_invoice_urlnullable string

The URL for the hosted invoice page, which allows customers to view and pay an invoice. null if the invoice has not been finalized yet.

invoice_pdfnullable string

The link to download the PDF for the invoice. null if the invoice has not been finalized yet.

lines object

The individual line items that make up the invoice. Sorted as: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order.

livemode boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

metadatanullable 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.

numbernullable string

A unique, identifying string that appears on emails sent to the customer for this invoice. Starts with the customer’s unique invoice_prefix if it is specified.

statusnullable enum

The status of the invoice, one of draft, open, paid, uncollectible, or void.

Possible enum values
draft
open
paid
uncollectible
void
status_transitions object

The timestamps at which the invoice status was updated.

subtotal integer

Total of all subscriptions, invoice items, and prorations on the invoice before any invoice-level discount or exclusive tax is applied. Item discounts are already incorporated.

total integer

Total after discounts and taxes.

More attributes

THE INVOICE OBJECT
{
  "id": "in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Zoneless Docs",
  "account_tax_ids": null,
  "amount_due": 0,
  "amount_paid": 0,
  "amount_overpaid": 0,
  "amount_remaining": 0,
  "amount_shipping": 0,
  "application": null,
  "attempt_count": 0,
  "attempted": false,
  "auto_advance": false,
  "automatic_tax": {
    "enabled": false,
    "liability": null,
    "status": null
  },
  "billing_reason": "manual",
  "collection_method": "charge_automatically",
  "created": 1723820400,
  "currency": "usdc",
  "custom_fields": null,
  "customer": "cus_z_TpL8wQkR3nVmY",
  "customer_address": null,
  "customer_email": "maya.chen@example.com",
  "customer_name": "Maya Chen",
  "customer_phone": null,
  "customer_shipping": null,
  "customer_tax_exempt": "none",
  "customer_tax_ids": [],
  "confirmation_secret": null,
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "description": null,
  "discounts": [],
  "due_date": null,
  "ending_balance": null,
  "footer": null,
  "from_invoice": null,
  "hosted_invoice_url": null,
  "invoice_pdf": null,
  "issuer": {
    "type": "self"
  },
  "last_finalization_error": null,
  "latest_revision": null,
  "lines": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoices/in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c/lines"
  },
  "payments": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoice_payments"
  },
  "livemode": false,
  "metadata": {},
  "next_payment_attempt": null,
  "number": null,
  "on_behalf_of": null,
  "parent": null,
  "payment_settings": {
    "default_mandate": null,
    "payment_method_options": null,
    "payment_method_types": null
  },
  "period_end": 1723820400,
  "period_start": 1723820400,
  "post_payment_credit_notes_amount": 0,
  "pre_payment_credit_notes_amount": 0,
  "receipt_number": null,
  "shipping_cost": null,
  "shipping_details": null,
  "starting_balance": 0,
  "statement_descriptor": null,
  "status": "draft",
  "status_transitions": {
    "finalized_at": null,
    "marked_uncollectible_at": null,
    "paid_at": null,
    "voided_at": null
  },
  "subtotal": 0,
  "subtotal_excluding_tax": 0,
  "test_clock": null,
  "total": 0,
  "total_discount_amounts": [],
  "total_excluding_tax": 0,
  "total_taxes": [],
  "transfer_data": null,
  "webhooks_delivered_at": 1723820400,
  "platform_account": "acct_z_Platform123abc"
}

Create an invoice

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.

ENDPOINTS
POST /v1/invoices

Parameters

customer string Required unless from_invoice is provided

The ID of the customer to bill.

collection_method enum

Either charge_automatically or send_invoice. When charging automatically, Zoneless attempts to pay this invoice using the default payment method attached to the customer. When sending an invoice, Zoneless emails the customer with payment instructions. Defaults to charge_automatically.

Possible enum values
charge_automatically
send_invoice
currency enum

The currency to create this invoice in. Defaults to that of customer if not specified. For Zoneless, use usdc.

Difference from Stripe: Use usdc instead of fiat currency codes like usd.

description string

An arbitrary string attached to the object. Often useful for displaying to users. Referenced as “memo” in the Dashboard.

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.

More attributes

Returns

Returns the invoice object. Raises an error if the customer ID provided is invalid.

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

const invoice = await zoneless.invoices.create({
  customer: 'cus_z_TpL8wQkR3nVmY',
});
RESPONSE
{
  "id": "in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Zoneless Docs",
  "account_tax_ids": null,
  "amount_due": 0,
  "amount_paid": 0,
  "amount_overpaid": 0,
  "amount_remaining": 0,
  "amount_shipping": 0,
  "application": null,
  "attempt_count": 0,
  "attempted": false,
  "auto_advance": false,
  "automatic_tax": {
    "enabled": false,
    "liability": null,
    "status": null
  },
  "billing_reason": "manual",
  "collection_method": "charge_automatically",
  "created": 1723820400,
  "currency": "usdc",
  "custom_fields": null,
  "customer": "cus_z_TpL8wQkR3nVmY",
  "customer_address": null,
  "customer_email": "maya.chen@example.com",
  "customer_name": "Maya Chen",
  "customer_phone": null,
  "customer_shipping": null,
  "customer_tax_exempt": "none",
  "customer_tax_ids": [],
  "confirmation_secret": null,
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "description": null,
  "discounts": [],
  "due_date": null,
  "ending_balance": null,
  "footer": null,
  "from_invoice": null,
  "hosted_invoice_url": null,
  "invoice_pdf": null,
  "issuer": {
    "type": "self"
  },
  "last_finalization_error": null,
  "latest_revision": null,
  "lines": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoices/in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c/lines"
  },
  "payments": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoice_payments"
  },
  "livemode": false,
  "metadata": {},
  "next_payment_attempt": null,
  "number": null,
  "on_behalf_of": null,
  "parent": null,
  "payment_settings": {
    "default_mandate": null,
    "payment_method_options": null,
    "payment_method_types": null
  },
  "period_end": 1723820400,
  "period_start": 1723820400,
  "post_payment_credit_notes_amount": 0,
  "pre_payment_credit_notes_amount": 0,
  "receipt_number": null,
  "shipping_cost": null,
  "shipping_details": null,
  "starting_balance": 0,
  "statement_descriptor": null,
  "status": "draft",
  "status_transitions": {
    "finalized_at": null,
    "marked_uncollectible_at": null,
    "paid_at": null,
    "voided_at": null
  },
  "subtotal": 0,
  "subtotal_excluding_tax": 0,
  "test_clock": null,
  "total": 0,
  "total_discount_amounts": [],
  "total_excluding_tax": 0,
  "total_taxes": [],
  "transfer_data": null,
  "webhooks_delivered_at": 1723820400,
  "platform_account": "acct_z_Platform123abc"
}

Update an invoice

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 Zoneless from automatically finalizing, reattempting payments on, or sending reminders for invoices, pass auto_advance=false.

ENDPOINTS
POST /v1/invoices/:id

Parameters

auto_advance boolean

Controls whether Zoneless performs automatic collection of the invoice.

collection_method enum

Either charge_automatically or send_invoice. This field can be updated only on draft invoices.

Possible enum values
charge_automatically
send_invoice
description string

An arbitrary string attached to the object. Often useful for displaying to users. Referenced as “memo” in the Dashboard.

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.

More attributes

Returns

Returns the invoice object.

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

const invoice = await zoneless.invoices.update(
  'in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c',
  {
    metadata: {
      order_id: '9284',
    },
  }
);
RESPONSE
{
  "id": "in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Zoneless Docs",
  "account_tax_ids": null,
  "amount_due": 0,
  "amount_paid": 0,
  "amount_overpaid": 0,
  "amount_remaining": 0,
  "amount_shipping": 0,
  "application": null,
  "attempt_count": 0,
  "attempted": false,
  "auto_advance": false,
  "automatic_tax": {
    "enabled": false,
    "liability": null,
    "status": null
  },
  "billing_reason": "manual",
  "collection_method": "charge_automatically",
  "created": 1723820400,
  "currency": "usdc",
  "custom_fields": null,
  "customer": "cus_z_TpL8wQkR3nVmY",
  "customer_address": null,
  "customer_email": "maya.chen@example.com",
  "customer_name": "Maya Chen",
  "customer_phone": null,
  "customer_shipping": null,
  "customer_tax_exempt": "none",
  "customer_tax_ids": [],
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "description": null,
  "discounts": [],
  "due_date": null,
  "ending_balance": null,
  "footer": null,
  "from_invoice": null,
  "hosted_invoice_url": null,
  "invoice_pdf": null,
  "issuer": {
    "type": "self"
  },
  "last_finalization_error": null,
  "latest_revision": null,
  "lines": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoices/in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c/lines"
  },
  "livemode": false,
  "metadata": {
    "order_id": "9284"
  },
  "next_payment_attempt": null,
  "number": null,
  "on_behalf_of": null,
  "parent": null,
  "payment_settings": {
    "default_mandate": null,
    "payment_method_options": null,
    "payment_method_types": null
  },
  "period_end": 1723820400,
  "period_start": 1723820400,
  "post_payment_credit_notes_amount": 0,
  "pre_payment_credit_notes_amount": 0,
  "receipt_number": null,
  "shipping_cost": null,
  "shipping_details": null,
  "starting_balance": 0,
  "statement_descriptor": null,
  "status": "draft",
  "status_transitions": {
    "finalized_at": null,
    "marked_uncollectible_at": null,
    "paid_at": null,
    "voided_at": null
  },
  "subtotal": 0,
  "subtotal_excluding_tax": 0,
  "test_clock": null,
  "total": 0,
  "total_discount_amounts": [],
  "total_excluding_tax": 0,
  "total_taxes": [],
  "webhooks_delivered_at": 1723820400,
  "platform_account": "acct_z_Platform123abc"
}

Retrieve an invoice

Retrieves the invoice with the given ID.

ENDPOINTS
GET /v1/invoices/:id

Returns

Returns an invoice object if a valid invoice ID was provided. Raises an error otherwise. The invoice object contains a lines hash with subscriptions and invoice items applied to the invoice, as well as any prorations Zoneless has automatically calculated. The invoice also has a next_payment_attempt attribute that tells you the next time payment will be automatically attempted. For invoices with manual payment collection, that have been closed, or that have reached the maximum number of retries, next_payment_attempt is null.

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

const invoice = await zoneless.invoices.retrieve(
  'in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c'
);
RESPONSE
{
  "id": "in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Zoneless Docs",
  "account_tax_ids": null,
  "amount_due": 0,
  "amount_paid": 0,
  "amount_overpaid": 0,
  "amount_remaining": 0,
  "amount_shipping": 0,
  "application": null,
  "attempt_count": 0,
  "attempted": false,
  "auto_advance": false,
  "automatic_tax": {
    "enabled": false,
    "liability": null,
    "status": null
  },
  "billing_reason": "manual",
  "collection_method": "charge_automatically",
  "created": 1723820400,
  "currency": "usdc",
  "custom_fields": null,
  "customer": "cus_z_TpL8wQkR3nVmY",
  "customer_address": null,
  "customer_email": "maya.chen@example.com",
  "customer_name": "Maya Chen",
  "customer_phone": null,
  "customer_shipping": null,
  "customer_tax_exempt": "none",
  "customer_tax_ids": [],
  "confirmation_secret": null,
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "description": null,
  "discounts": [],
  "due_date": null,
  "ending_balance": null,
  "footer": null,
  "from_invoice": null,
  "hosted_invoice_url": null,
  "invoice_pdf": null,
  "issuer": {
    "type": "self"
  },
  "last_finalization_error": null,
  "latest_revision": null,
  "lines": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoices/in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c/lines"
  },
  "payments": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoice_payments"
  },
  "livemode": false,
  "metadata": {},
  "next_payment_attempt": null,
  "number": null,
  "on_behalf_of": null,
  "parent": null,
  "payment_settings": {
    "default_mandate": null,
    "payment_method_options": null,
    "payment_method_types": null
  },
  "period_end": 1723820400,
  "period_start": 1723820400,
  "post_payment_credit_notes_amount": 0,
  "pre_payment_credit_notes_amount": 0,
  "receipt_number": null,
  "shipping_cost": null,
  "shipping_details": null,
  "starting_balance": 0,
  "statement_descriptor": null,
  "status": "draft",
  "status_transitions": {
    "finalized_at": null,
    "marked_uncollectible_at": null,
    "paid_at": null,
    "voided_at": null
  },
  "subtotal": 0,
  "subtotal_excluding_tax": 0,
  "test_clock": null,
  "total": 0,
  "total_discount_amounts": [],
  "total_excluding_tax": 0,
  "total_taxes": [],
  "transfer_data": null,
  "webhooks_delivered_at": 1723820400,
  "platform_account": "acct_z_Platform123abc"
}

List all invoices

You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.

ENDPOINTS
GET /v1/invoices

Parameters

customer string

Only return invoices for the customer specified by this customer ID.

status enum

The status of the invoice, one of draft, open, paid, uncollectible, or void.

Possible enum values
draft
open
paid
uncollectible
void
subscription string

Only return invoices for the subscription specified by this subscription ID.

limit integer

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

More attributes

Returns

A dictionary with a data property that contains an array of up to limit invoices, starting after invoice starting_after. Each entry in the array is a separate invoice object. If no more invoices are available, the resulting array is empty.

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

const invoices = await zoneless.invoices.list({
  limit: 3,
});
RESPONSE
{
  "object": "list",
  "url": "/v1/invoices",
  "has_more": false,
  "data": [
    {
      "id": "in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c",
      "object": "invoice",
      "account_country": "US",
      "account_name": "Zoneless Docs",
      "account_tax_ids": null,
      "amount_due": 0,
      "amount_paid": 0,
      "amount_overpaid": 0,
      "amount_remaining": 0,
      "amount_shipping": 0,
      "application": null,
      "attempt_count": 0,
      "attempted": false,
      "auto_advance": false,
      "automatic_tax": {
        "enabled": false,
        "liability": null,
        "status": null
      },
      "billing_reason": "manual",
      "collection_method": "charge_automatically",
      "created": 1723820400,
      "currency": "usdc",
      "custom_fields": null,
      "customer": "cus_z_TpL8wQkR3nVmY",
      "customer_address": null,
      "customer_email": "maya.chen@example.com",
      "customer_name": "Maya Chen",
      "customer_phone": null,
      "customer_shipping": null,
      "customer_tax_exempt": "none",
      "customer_tax_ids": [],
      "default_payment_method": null,
      "default_source": null,
      "default_tax_rates": [],
      "description": null,
      "discounts": [],
      "due_date": null,
      "ending_balance": null,
      "footer": null,
      "from_invoice": null,
      "hosted_invoice_url": null,
      "invoice_pdf": null,
      "issuer": {
        "type": "self"
      },
      "last_finalization_error": null,
      "latest_revision": null,
      "lines": {
        "object": "list",
        "data": [],
        "has_more": false,
        "total_count": 0,
        "url": "/v1/invoices/in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c/lines"
      },
      "livemode": false,
      "metadata": {},
      "next_payment_attempt": null,
      "number": null,
      "on_behalf_of": null,
      "parent": null,
      "payment_settings": {
        "default_mandate": null,
        "payment_method_options": null,
        "payment_method_types": null
      },
      "period_end": 1723820400,
      "period_start": 1723820400,
      "post_payment_credit_notes_amount": 0,
      "pre_payment_credit_notes_amount": 0,
      "receipt_number": null,
      "shipping_cost": null,
      "shipping_details": null,
      "starting_balance": 0,
      "statement_descriptor": null,
      "status": "draft",
      "status_transitions": {
        "finalized_at": null,
        "marked_uncollectible_at": null,
        "paid_at": null,
        "voided_at": null
      },
      "subtotal": 0,
      "subtotal_excluding_tax": 0,
      "test_clock": null,
      "total": 0,
      "total_discount_amounts": [],
      "total_excluding_tax": 0,
      "total_taxes": [],
      "webhooks_delivered_at": 1723820400,
      "platform_account": "acct_z_Platform123abc"
    }
  ]
}

Delete a draft invoice

Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be voided.

ENDPOINTS
DELETE /v1/invoices/:id

Returns

A successfully deleted invoice. Otherwise, this call raises an error, such as if the invoice has already been deleted.

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

const deleted = await zoneless.invoices.del(
  'in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c'
);
RESPONSE
{
  "id": "in_z_1RvK8pQ2eZvKYlo2Hn4mWx9c",
  "object": "invoice",
  "deleted": true
}

Finalize an invoice

Zoneless automatically finalizes drafts before sending and attempting payment on invoices. However, if you’d like to finalize a draft invoice manually, you can do so using this method.

ENDPOINTS
POST /v1/invoices/:id/finalize

Parameters

auto_advance boolean

Controls whether Zoneless performs automatic collection of the invoice. If false, the invoice’s state doesn’t automatically advance without an explicit action.

Returns

Returns an invoice object with status=open (or paid if the amount due is zero).

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

const invoice = await zoneless.invoices.finalizeInvoice(
  'in_z_1RvK9aH3fZwLXmp3Jo5nXy0d'
);
RESPONSE
{
  "id": "in_z_1RvK9aH3fZwLXmp3Jo5nXy0d",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Zoneless Docs",
  "account_tax_ids": null,
  "amount_due": 0,
  "amount_paid": 0,
  "amount_overpaid": 0,
  "amount_remaining": 0,
  "amount_shipping": 0,
  "application": null,
  "attempt_count": 0,
  "attempted": true,
  "auto_advance": false,
  "automatic_tax": {
    "enabled": false,
    "liability": null,
    "status": null
  },
  "billing_reason": "manual",
  "collection_method": "send_invoice",
  "created": 1723824000,
  "currency": "usdc",
  "custom_fields": null,
  "customer": "cus_z_TpL8wQkR3nVmY",
  "customer_address": null,
  "customer_email": "maya.chen@example.com",
  "customer_name": "Maya Chen",
  "customer_phone": null,
  "customer_shipping": null,
  "customer_tax_exempt": "none",
  "customer_tax_ids": [],
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "description": null,
  "discounts": [],
  "due_date": 1724428800,
  "ending_balance": 0,
  "footer": null,
  "from_invoice": null,
  "hosted_invoice_url": "https://invoice.yourdomain.com/i/acct_z_Platform123abc/test_aW52b2ljZV96XzFSdk...",
  "invoice_pdf": "https://pay.yourdomain.com/invoice/acct_z_Platform123abc/test_aW52b2ljZV96XzFSdk.../pdf",
  "issuer": {
    "type": "self"
  },
  "last_finalization_error": null,
  "latest_revision": null,
  "lines": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoices/in_z_1RvK9aH3fZwLXmp3Jo5nXy0d/lines"
  },
  "livemode": false,
  "metadata": {},
  "next_payment_attempt": null,
  "number": "7B3C9E12-0001",
  "on_behalf_of": null,
  "parent": null,
  "payment_settings": {
    "default_mandate": null,
    "payment_method_options": null,
    "payment_method_types": null
  },
  "period_end": 1723824000,
  "period_start": 1723824000,
  "post_payment_credit_notes_amount": 0,
  "pre_payment_credit_notes_amount": 0,
  "receipt_number": null,
  "shipping_cost": null,
  "shipping_details": null,
  "starting_balance": 0,
  "statement_descriptor": null,
  "status": "paid",
  "status_transitions": {
    "finalized_at": 1723824000,
    "marked_uncollectible_at": null,
    "paid_at": 1723824000,
    "voided_at": null
  },
  "subtotal": 0,
  "subtotal_excluding_tax": 0,
  "test_clock": null,
  "total": 0,
  "total_discount_amounts": [],
  "total_excluding_tax": 0,
  "total_taxes": [],
  "webhooks_delivered_at": 1723824000,
  "platform_account": "acct_z_Platform123abc"
}

Mark an invoice as uncollectible

Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.

ENDPOINTS
POST /v1/invoices/:id/mark_uncollectible

Returns

Returns the invoice object.

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

const invoice = await zoneless.invoices.markUncollectible(
  'in_z_1RvJ4mN1dYuKXkn2Gi3lVw8b'
);
RESPONSE
{
  "id": "in_z_1RvJ4mN1dYuKXkn2Gi3lVw8b",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Zoneless Docs",
  "account_tax_ids": null,
  "amount_due": 2499,
  "amount_paid": 0,
  "amount_overpaid": 0,
  "amount_remaining": 2499,
  "amount_shipping": 0,
  "application": null,
  "attempt_count": 0,
  "attempted": false,
  "auto_advance": false,
  "automatic_tax": {
    "enabled": false,
    "liability": null,
    "status": null
  },
  "billing_reason": "manual",
  "collection_method": "charge_automatically",
  "created": 1723737600,
  "currency": "usdc",
  "custom_fields": null,
  "customer": "cus_z_TpL8wQkR3nVmY",
  "customer_address": null,
  "customer_email": "maya.chen@example.com",
  "customer_name": "Maya Chen",
  "customer_phone": null,
  "customer_shipping": null,
  "customer_tax_exempt": "none",
  "customer_tax_ids": [],
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "description": null,
  "discounts": [],
  "due_date": null,
  "ending_balance": null,
  "footer": null,
  "from_invoice": null,
  "hosted_invoice_url": null,
  "invoice_pdf": null,
  "issuer": {
    "type": "self"
  },
  "last_finalization_error": null,
  "latest_revision": null,
  "lines": {
    "object": "list",
    "data": [
      {
        "id": "il_z_1RvJ4mN1dYuKXkn2Hk4pVx9c",
        "object": "line_item",
        "amount": 2499,
        "currency": "usdc",
        "description": "API usage credit pack",
        "discount_amounts": [],
        "discountable": true,
        "discounts": [],
        "livemode": false,
        "metadata": {},
        "parent": {
          "type": "invoice_item_details",
          "invoice_item_details": {
            "invoice_item": "ii_z_1RvJ4mN1dYuKXkn2Gj3oUw7a",
            "proration": false,
            "proration_details": {
              "credited_items": null
            },
            "subscription": null
          }
        },
        "period": {
          "end": 1723737600,
          "start": 1723737600
        },
        "pricing": {
          "price_details": {
            "price": "price_z_1RvJ3kM0cXtJWjm1Fi2nTu6z",
            "product": "prod_z_TpL8xRcS4oWnZ"
          },
          "type": "price_details",
          "unit_amount_decimal": "2499"
        },
        "quantity": 1,
        "quantity_decimal": "1",
        "taxes": []
      }
    ],
    "has_more": false,
    "url": "/v1/invoices/in_z_1RvJ4mN1dYuKXkn2Gi3lVw8b/lines"
  },
  "livemode": false,
  "metadata": {},
  "next_payment_attempt": null,
  "number": null,
  "on_behalf_of": null,
  "parent": null,
  "payment_settings": {
    "default_mandate": null,
    "payment_method_options": null,
    "payment_method_types": null
  },
  "period_end": 1723737600,
  "period_start": 1723737600,
  "post_payment_credit_notes_amount": 0,
  "pre_payment_credit_notes_amount": 0,
  "receipt_number": null,
  "shipping_cost": null,
  "shipping_details": null,
  "starting_balance": 0,
  "statement_descriptor": null,
  "status": "uncollectible",
  "status_transitions": {
    "finalized_at": 1723737800,
    "marked_uncollectible_at": 1723900000,
    "paid_at": null,
    "voided_at": null
  },
  "subtotal": 2499,
  "subtotal_excluding_tax": 2499,
  "test_clock": null,
  "total": 2499,
  "total_discount_amounts": [],
  "total_excluding_tax": 2499,
  "total_taxes": [],
  "webhooks_delivered_at": 1723737800,
  "platform_account": "acct_z_Platform123abc"
}

Pay an invoice

Zoneless automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your billing settings. However, if you’d like to attempt payment on an invoice outside of the normal collection schedule, you can do so with this endpoint. Collection settles in USDC on Solana.

ENDPOINTS
POST /v1/invoices/:id/pay

Parameters

paid_out_of_band boolean

Boolean representing whether an invoice is paid outside of Zoneless. This results in no on-chain collection being made. Defaults to false.

payment_method string

A PaymentMethod to be charged. The PaymentMethod must belong to the customer associated with the invoice being paid.

settlement_signature string

When set, skip on-chain collect and record settlement with this Solana transaction signature (for example, when checkout already collected the first period).

Zoneless extension: This field is not present in Stripe's API.

More attributes

Returns

Returns the invoice object.

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

const invoice = await zoneless.invoices.pay(
  'in_z_1RvK9aH3fZwLXmp3Jo5nXy0d'
);
RESPONSE
{
  "id": "in_z_1RvK9aH3fZwLXmp3Jo5nXy0d",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Zoneless Docs",
  "account_tax_ids": null,
  "amount_due": 0,
  "amount_paid": 0,
  "amount_overpaid": 0,
  "amount_remaining": 0,
  "amount_shipping": 0,
  "application": null,
  "attempt_count": 0,
  "attempted": true,
  "auto_advance": false,
  "automatic_tax": {
    "enabled": false,
    "liability": null,
    "status": null
  },
  "billing_reason": "manual",
  "collection_method": "send_invoice",
  "created": 1723824000,
  "currency": "usdc",
  "custom_fields": null,
  "customer": "cus_z_TpL8wQkR3nVmY",
  "customer_address": null,
  "customer_email": "maya.chen@example.com",
  "customer_name": "Maya Chen",
  "customer_phone": null,
  "customer_shipping": null,
  "customer_tax_exempt": "none",
  "customer_tax_ids": [],
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "description": null,
  "discounts": [],
  "due_date": 1724428800,
  "ending_balance": 0,
  "footer": null,
  "from_invoice": null,
  "hosted_invoice_url": "https://invoice.yourdomain.com/i/acct_z_Platform123abc/test_aW52b2ljZV96XzFSdk...",
  "invoice_pdf": "https://pay.yourdomain.com/invoice/acct_z_Platform123abc/test_aW52b2ljZV96XzFSdk.../pdf",
  "issuer": {
    "type": "self"
  },
  "last_finalization_error": null,
  "latest_revision": null,
  "lines": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoices/in_z_1RvK9aH3fZwLXmp3Jo5nXy0d/lines"
  },
  "livemode": false,
  "metadata": {},
  "next_payment_attempt": null,
  "number": "7B3C9E12-0001",
  "on_behalf_of": null,
  "parent": null,
  "payment_settings": {
    "default_mandate": null,
    "payment_method_options": null,
    "payment_method_types": null
  },
  "period_end": 1723824000,
  "period_start": 1723824000,
  "post_payment_credit_notes_amount": 0,
  "pre_payment_credit_notes_amount": 0,
  "receipt_number": null,
  "shipping_cost": null,
  "shipping_details": null,
  "starting_balance": 0,
  "statement_descriptor": null,
  "status": "paid",
  "status_transitions": {
    "finalized_at": 1723824000,
    "marked_uncollectible_at": null,
    "paid_at": 1723824000,
    "voided_at": null
  },
  "subtotal": 0,
  "subtotal_excluding_tax": 0,
  "test_clock": null,
  "total": 0,
  "total_discount_amounts": [],
  "total_excluding_tax": 0,
  "total_taxes": [],
  "webhooks_delivered_at": 1723824000,
  "platform_account": "acct_z_Platform123abc"
}

Void an invoice

Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to deletion, however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you’re doing business in. You might need to issue another invoice or a credit note instead.

ENDPOINTS
POST /v1/invoices/:id/void

Returns

Returns the voided invoice object.

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

const invoice = await zoneless.invoices.voidInvoice(
  'in_z_1RvK9aH3fZwLXmp3Jo5nXy0d'
);
RESPONSE
{
  "id": "in_z_1RvK9aH3fZwLXmp3Jo5nXy0d",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Zoneless Docs",
  "account_tax_ids": null,
  "amount_due": 0,
  "amount_paid": 0,
  "amount_overpaid": 0,
  "amount_remaining": 0,
  "amount_shipping": 0,
  "application": null,
  "attempt_count": 0,
  "attempted": false,
  "auto_advance": false,
  "automatic_tax": {
    "enabled": false,
    "liability": null,
    "status": null
  },
  "billing_reason": "manual",
  "collection_method": "charge_automatically",
  "created": 1723820400,
  "currency": "usdc",
  "custom_fields": null,
  "customer": "cus_z_TpL8wQkR3nVmY",
  "customer_address": null,
  "customer_email": "maya.chen@example.com",
  "customer_name": "Maya Chen",
  "customer_phone": null,
  "customer_shipping": null,
  "customer_tax_exempt": "none",
  "customer_tax_ids": [],
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [],
  "description": null,
  "discounts": [],
  "due_date": null,
  "ending_balance": null,
  "footer": null,
  "from_invoice": null,
  "hosted_invoice_url": null,
  "invoice_pdf": null,
  "issuer": {
    "type": "self"
  },
  "last_finalization_error": null,
  "latest_revision": null,
  "lines": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/invoices/in_z_1RvK9aH3fZwLXmp3Jo5nXy0d/lines"
  },
  "livemode": false,
  "metadata": {},
  "next_payment_attempt": null,
  "number": null,
  "on_behalf_of": null,
  "parent": null,
  "payment_settings": {
    "default_mandate": null,
    "payment_method_options": null,
    "payment_method_types": null
  },
  "period_end": 1723820400,
  "period_start": 1723820400,
  "post_payment_credit_notes_amount": 0,
  "pre_payment_credit_notes_amount": 0,
  "receipt_number": null,
  "shipping_cost": null,
  "shipping_details": null,
  "starting_balance": 0,
  "statement_descriptor": null,
  "status": "void",
  "status_transitions": {
    "finalized_at": 1723821000,
    "marked_uncollectible_at": null,
    "paid_at": null,
    "voided_at": 1723905000
  },
  "subtotal": 0,
  "subtotal_excluding_tax": 0,
  "test_clock": null,
  "total": 0,
  "total_discount_amounts": [],
  "total_excluding_tax": 0,
  "total_taxes": [],
  "webhooks_delivered_at": 1723820400,
  "platform_account": "acct_z_Platform123abc"
}