---
title: "nextmail billing"
description: "Every command in this namespace, with its arguments, flags and examples."
url: "https://nextmail.sh/docs/cli/reference/billing"
area: "CLI"
category: "Reference"
---

# nextmail billing

Every command in this namespace, with its arguments, flags and examples.

## Commands

### `nextmail billing get`

Read the plan

```bash
nextmail billing get [flags]
```

Resolves the plan of the workspace and what it includes, as Billing shows it: how it is billed, when it renews or ends and the next charge, how many domains it holds, how much of this month's sends and today's AI actions are used, and pay as you go. `metered` is false while billing is switched off, and then nothing is capped.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.
- Aliases: `show`, `view`.

**Examples**

```bash
nextmail billing get
```

Print the raw JSON

```bash
nextmail billing get --json
```

Also available in: API [`GET /billing`](https://nextmail.sh/docs/api/reference/billing#get-billing); TypeScript [`nextmail.billing.get()`](https://nextmail.sh/docs/sdk/reference/billing#get); Python [`billing.get()`](https://nextmail.sh/docs/python/reference/billing#get); Ruby [`billing.get`](https://nextmail.sh/docs/ruby/reference/billing#get); PHP [`billing->get`](https://nextmail.sh/docs/php/reference/billing#get); Go [`Billing.Get`](https://nextmail.sh/docs/go/reference/billing#get); Java [`billing().get`](https://nextmail.sh/docs/java/reference/billing#get); C# [`Billing.GetAsync`](https://nextmail.sh/docs/csharp/reference/billing#get).

### `nextmail billing list-plans`

List the plans

```bash
nextmail billing list-plans [flags]
```

Resolves every plan, cheapest first, with its price in US cents and what it includes. `available` says whether it is on sale, and `intervals` the billing intervals it is sold at.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.

**Examples**

```bash
nextmail billing list-plans
```

Print the raw JSON

```bash
nextmail billing list-plans --json
```

Also available in: API [`GET /billing/plans`](https://nextmail.sh/docs/api/reference/billing#get-billing-plans); TypeScript [`nextmail.billing.listPlans()`](https://nextmail.sh/docs/sdk/reference/billing#listPlans); Python [`billing.list_plans()`](https://nextmail.sh/docs/python/reference/billing#listPlans); Ruby [`billing.list_plans`](https://nextmail.sh/docs/ruby/reference/billing#listPlans); PHP [`billing->listPlans`](https://nextmail.sh/docs/php/reference/billing#listPlans); Go [`Billing.ListPlans`](https://nextmail.sh/docs/go/reference/billing#listPlans); Java [`billing().listPlans`](https://nextmail.sh/docs/java/reference/billing#listPlans); C# [`Billing.ListPlansAsync`](https://nextmail.sh/docs/csharp/reference/billing#listPlans).

### `nextmail billing get-usage`

Read the usage history

```bash
nextmail billing get-usage [flags]
```

Resolves the sends and AI actions of each day, and what pay as you go extras cost each month, as the Usage charts show them.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.

**Flags**

- `--days <value>`: How many days back to go, from 1 to 3,660, or `all` for every day since the workspace was made. The server defaults to 30.

**Examples**

```bash
nextmail billing get-usage
```

With optional flags

```bash
nextmail billing get-usage --days 90
```

Print the raw JSON

```bash
nextmail billing get-usage --json
```

Also available in: API [`GET /billing/usage`](https://nextmail.sh/docs/api/reference/billing#get-billing-usage); TypeScript [`nextmail.billing.getUsage()`](https://nextmail.sh/docs/sdk/reference/billing#getUsage); Python [`billing.get_usage()`](https://nextmail.sh/docs/python/reference/billing#getUsage); Ruby [`billing.get_usage`](https://nextmail.sh/docs/ruby/reference/billing#getUsage); PHP [`billing->getUsage`](https://nextmail.sh/docs/php/reference/billing#getUsage); Go [`Billing.GetUsage`](https://nextmail.sh/docs/go/reference/billing#getUsage); Java [`billing().getUsage`](https://nextmail.sh/docs/java/reference/billing#getUsage); C# [`Billing.GetUsageAsync`](https://nextmail.sh/docs/csharp/reference/billing#getUsage).

### `nextmail billing list-alerts`

List the billing alerts

```bash
nextmail billing list-alerts [flags]
```

Resolves what the billing banner of the app would say now, most urgent first: a failed payment, paused pay as you go, sending or AI paused at a limit, a plan about to end, an allowance nearly used and a charge coming soon. An empty list means there is nothing to say.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.

**Examples**

```bash
nextmail billing list-alerts
```

Print the raw JSON

```bash
nextmail billing list-alerts --json
```

Also available in: API [`GET /billing/alerts`](https://nextmail.sh/docs/api/reference/billing#get-billing-alerts); TypeScript [`nextmail.billing.listAlerts()`](https://nextmail.sh/docs/sdk/reference/billing#listAlerts); Python [`billing.list_alerts()`](https://nextmail.sh/docs/python/reference/billing#listAlerts); Ruby [`billing.list_alerts`](https://nextmail.sh/docs/ruby/reference/billing#listAlerts); PHP [`billing->listAlerts`](https://nextmail.sh/docs/php/reference/billing#listAlerts); Go [`Billing.ListAlerts`](https://nextmail.sh/docs/go/reference/billing#listAlerts); Java [`billing().listAlerts`](https://nextmail.sh/docs/java/reference/billing#listAlerts); C# [`Billing.ListAlertsAsync`](https://nextmail.sh/docs/csharp/reference/billing#listAlerts).

### `nextmail billing list-countries`

List the billing countries

```bash
nextmail billing list-countries [flags]
```

Resolves every country a billing address can be in, as the two-letter ISO 3166 codes `saveInvoiceDetails` takes as `country`.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.

**Examples**

```bash
nextmail billing list-countries
```

Print the raw JSON

```bash
nextmail billing list-countries --json
```

Also available in: API [`GET /billing/countries`](https://nextmail.sh/docs/api/reference/billing#get-billing-countries); TypeScript [`nextmail.billing.listCountries()`](https://nextmail.sh/docs/sdk/reference/billing#listCountries); Python [`billing.list_countries()`](https://nextmail.sh/docs/python/reference/billing#listCountries); Ruby [`billing.list_countries`](https://nextmail.sh/docs/ruby/reference/billing#listCountries); PHP [`billing->listCountries`](https://nextmail.sh/docs/php/reference/billing#listCountries); Go [`Billing.ListCountries`](https://nextmail.sh/docs/go/reference/billing#listCountries); Java [`billing().listCountries`](https://nextmail.sh/docs/java/reference/billing#listCountries); C# [`Billing.ListCountriesAsync`](https://nextmail.sh/docs/csharp/reference/billing#listCountries).

### `nextmail billing get-pay-as-you-go`

Read pay as you go

```bash
nextmail billing get-pay-as-you-go [flags]
```

Resolves pay as you go on the workspace: whether usage past the allowances is billed, the monthly limit and what extras cost so far, the current billing period once it is set up, the limits that can be chosen and the prices.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.

**Examples**

```bash
nextmail billing get-pay-as-you-go
```

Print the raw JSON

```bash
nextmail billing get-pay-as-you-go --json
```

Also available in: API [`GET /billing/pay-as-you-go`](https://nextmail.sh/docs/api/reference/billing#get-billing-pay-as-you-go); TypeScript [`nextmail.billing.getPayAsYouGo()`](https://nextmail.sh/docs/sdk/reference/billing#getPayAsYouGo); Python [`billing.get_pay_as_you_go()`](https://nextmail.sh/docs/python/reference/billing#getPayAsYouGo); Ruby [`billing.get_pay_as_you_go`](https://nextmail.sh/docs/ruby/reference/billing#getPayAsYouGo); PHP [`billing->getPayAsYouGo`](https://nextmail.sh/docs/php/reference/billing#getPayAsYouGo); Go [`Billing.GetPayAsYouGo`](https://nextmail.sh/docs/go/reference/billing#getPayAsYouGo); Java [`billing().getPayAsYouGo`](https://nextmail.sh/docs/java/reference/billing#getPayAsYouGo); C# [`Billing.GetPayAsYouGoAsync`](https://nextmail.sh/docs/csharp/reference/billing#getPayAsYouGo).

### `nextmail billing set-pay-as-you-go`

Turn pay as you go on or off

```bash
nextmail billing set-pay-as-you-go --enabled [flags]
nextmail billing set-pay-as-you-go --data <json|@file|-> [flags]
```

Turns pay as you go on or off, as the switch on Billing does. Off takes effect at once, and usage stops at the allowances. On takes effect at once when a card is already saved. The first time, `checkoutUrl` is a link where the person adds a card, and pay as you go starts once they have: call `confirmPayAsYouGo` after they return.

Nothing is paid through the API: the person pays, changes the card or cancels on the billing provider's page the link opens, as they do from the app.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:write`.
- Needs a sign-in.

**Flags**

- `--enabled`: `true` to turn it on, `false` to turn it off. Required, here or in `--data`.
- `--theme <value>`: `light` or `dark`, for the page the link opens.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

```bash
nextmail billing set-pay-as-you-go --enabled
```

Read the whole body from a JSON file

```bash
nextmail billing set-pay-as-you-go --data @billing.json
```

Also available in: API [`PATCH /billing/pay-as-you-go`](https://nextmail.sh/docs/api/reference/billing#patch-billing-pay-as-you-go); TypeScript [`nextmail.billing.setPayAsYouGo()`](https://nextmail.sh/docs/sdk/reference/billing#setPayAsYouGo); Python [`billing.set_pay_as_you_go()`](https://nextmail.sh/docs/python/reference/billing#setPayAsYouGo); Ruby [`billing.set_pay_as_you_go`](https://nextmail.sh/docs/ruby/reference/billing#setPayAsYouGo); PHP [`billing->setPayAsYouGo`](https://nextmail.sh/docs/php/reference/billing#setPayAsYouGo); Go [`Billing.SetPayAsYouGo`](https://nextmail.sh/docs/go/reference/billing#setPayAsYouGo); Java [`billing().setPayAsYouGo`](https://nextmail.sh/docs/java/reference/billing#setPayAsYouGo); C# [`Billing.SetPayAsYouGoAsync`](https://nextmail.sh/docs/csharp/reference/billing#setPayAsYouGo).

### `nextmail billing set-pay-as-you-go-limit`

Set the pay as you go limit

```bash
nextmail billing set-pay-as-you-go-limit --limit-cents <n> [flags]
nextmail billing set-pay-as-you-go-limit --data <json|@file|-> [flags]
```

Sets the monthly spending limit of pay as you go, in US cents, one of the amounts `getPayAsYouGo` lists in `limits`. Extras stop for the rest of a calendar month once it is reached.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:write`.
- Needs a sign-in.

**Flags**

- `--limit-cents <n>`: The limit in US cents: 1,000, 2,500, 5,000, 10,000, 25,000, 50,000, 100,000, 250,000 or 500,000. Required, here or in `--data`.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

```bash
nextmail billing set-pay-as-you-go-limit --limit-cents 1
```

Read the whole body from a JSON file

```bash
nextmail billing set-pay-as-you-go-limit --data @billing.json
```

Also available in: API [`PUT /billing/pay-as-you-go/limit`](https://nextmail.sh/docs/api/reference/billing#put-billing-pay-as-you-go-limit); TypeScript [`nextmail.billing.setPayAsYouGoLimit()`](https://nextmail.sh/docs/sdk/reference/billing#setPayAsYouGoLimit); Python [`billing.set_pay_as_you_go_limit()`](https://nextmail.sh/docs/python/reference/billing#setPayAsYouGoLimit); Ruby [`billing.set_pay_as_you_go_limit`](https://nextmail.sh/docs/ruby/reference/billing#setPayAsYouGoLimit); PHP [`billing->setPayAsYouGoLimit`](https://nextmail.sh/docs/php/reference/billing#setPayAsYouGoLimit); Go [`Billing.SetPayAsYouGoLimit`](https://nextmail.sh/docs/go/reference/billing#setPayAsYouGoLimit); Java [`billing().setPayAsYouGoLimit`](https://nextmail.sh/docs/java/reference/billing#setPayAsYouGoLimit); C# [`Billing.SetPayAsYouGoLimitAsync`](https://nextmail.sh/docs/csharp/reference/billing#setPayAsYouGoLimit).

### `nextmail billing confirm-pay-as-you-go`

Confirm pay as you go

```bash
nextmail billing confirm-pay-as-you-go [flags]
```

Checks with the billing provider whether the card from a pay as you go checkout was saved, and records it, as the app does when the person comes back from the checkout. `enabled` says whether pay as you go is on now.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:write`.
- Needs a sign-in.

**Examples**

```bash
nextmail billing confirm-pay-as-you-go
```

Print the raw JSON

```bash
nextmail billing confirm-pay-as-you-go --json
```

Also available in: API [`POST /billing/pay-as-you-go/confirm`](https://nextmail.sh/docs/api/reference/billing#post-billing-pay-as-you-go-confirm); TypeScript [`nextmail.billing.confirmPayAsYouGo()`](https://nextmail.sh/docs/sdk/reference/billing#confirmPayAsYouGo); Python [`billing.confirm_pay_as_you_go()`](https://nextmail.sh/docs/python/reference/billing#confirmPayAsYouGo); Ruby [`billing.confirm_pay_as_you_go`](https://nextmail.sh/docs/ruby/reference/billing#confirmPayAsYouGo); PHP [`billing->confirmPayAsYouGo`](https://nextmail.sh/docs/php/reference/billing#confirmPayAsYouGo); Go [`Billing.ConfirmPayAsYouGo`](https://nextmail.sh/docs/go/reference/billing#confirmPayAsYouGo); Java [`billing().confirmPayAsYouGo`](https://nextmail.sh/docs/java/reference/billing#confirmPayAsYouGo); C# [`Billing.ConfirmPayAsYouGoAsync`](https://nextmail.sh/docs/csharp/reference/billing#confirmPayAsYouGo).

### `nextmail billing start-checkout`

Start a checkout

```bash
nextmail billing start-checkout --plan <value> [flags]
nextmail billing start-checkout --data <json|@file|-> [flags]
```

Starts buying a paid plan for a workspace on Free, as choosing a plan in the app does, and resolves with the link to the checkout. Nothing is charged until the person pays there, and the plan starts once they have. A workspace that already pays for a plan changes it with `openPortal` instead.

Nothing is paid through the API: the person pays, changes the card or cancels on the billing provider's page the link opens, as they do from the app.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:write`.
- Needs a sign-in.

**Flags**

- `--plan <value>`: `starter`, `business` or `enterprise`. Required, here or in `--data`.
- `--interval <value>`: `month` or `year`. Defaults to `month`.
- `--theme <value>`: `light` or `dark`, for the page the link opens.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

The required values only

```bash
nextmail billing start-checkout --plan business
```

With optional flags

```bash
nextmail billing start-checkout --plan business --interval year
```

Read the whole body from a JSON file

```bash
nextmail billing start-checkout --data @billing.json
```

Also available in: API [`POST /billing/checkout`](https://nextmail.sh/docs/api/reference/billing#post-billing-checkout); TypeScript [`nextmail.billing.startCheckout()`](https://nextmail.sh/docs/sdk/reference/billing#startCheckout); Python [`billing.start_checkout()`](https://nextmail.sh/docs/python/reference/billing#startCheckout); Ruby [`billing.start_checkout`](https://nextmail.sh/docs/ruby/reference/billing#startCheckout); PHP [`billing->startCheckout`](https://nextmail.sh/docs/php/reference/billing#startCheckout); Go [`Billing.StartCheckout`](https://nextmail.sh/docs/go/reference/billing#startCheckout); Java [`billing().startCheckout`](https://nextmail.sh/docs/java/reference/billing#startCheckout); C# [`Billing.StartCheckoutAsync`](https://nextmail.sh/docs/csharp/reference/billing#startCheckout).

### `nextmail billing open-portal`

Open the billing portal

```bash
nextmail billing open-portal [flags]
```

Resolves with a link to the billing portal, where the person changes or cancels the plan, updates the card and downloads past invoices, as Manage does in the app.

Nothing is paid through the API: the person pays, changes the card or cancels on the billing provider's page the link opens, as they do from the app.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:write`.
- Needs a sign-in.

**Flags**

- `--theme <value>`: `light` or `dark`, for the page the link opens.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

```bash
nextmail billing open-portal
```

With optional flags

```bash
nextmail billing open-portal --theme dark
```

Also available in: API [`POST /billing/portal`](https://nextmail.sh/docs/api/reference/billing#post-billing-portal); TypeScript [`nextmail.billing.openPortal()`](https://nextmail.sh/docs/sdk/reference/billing#openPortal); Python [`billing.open_portal()`](https://nextmail.sh/docs/python/reference/billing#openPortal); Ruby [`billing.open_portal`](https://nextmail.sh/docs/ruby/reference/billing#openPortal); PHP [`billing->openPortal`](https://nextmail.sh/docs/php/reference/billing#openPortal); Go [`Billing.OpenPortal`](https://nextmail.sh/docs/go/reference/billing#openPortal); Java [`billing().openPortal`](https://nextmail.sh/docs/java/reference/billing#openPortal); C# [`Billing.OpenPortalAsync`](https://nextmail.sh/docs/csharp/reference/billing#openPortal).

### `nextmail billing list-invoices`

List the charges

```bash
nextmail billing list-invoices [flags]
```

Resolves every charge of the workspace with the state of its invoice, a page at a time, as History on Billing lists them. `search` matches the plan, the invoice number, the charge id and the name billed.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.

**Flags**

- `--page <n>` (default `1`): Which page, from 1.
- `--limit <n>` (default `25`): Charges per page, from 1 to 100. The server defaults to 25.
- `--sort <value>` (default `"newest"`): `newest`, the default, or `oldest`.
- `--search <value>`: Words to look for, up to 120 characters.

**Examples**

```bash
nextmail billing list-invoices
```

With optional flags

```bash
nextmail billing list-invoices --limit 10
```

Print the raw JSON

```bash
nextmail billing list-invoices --json
```

Also available in: API [`GET /billing/invoices`](https://nextmail.sh/docs/api/reference/billing#get-billing-invoices); TypeScript [`nextmail.billing.listInvoices()`](https://nextmail.sh/docs/sdk/reference/billing#listInvoices); Python [`billing.list_invoices()`](https://nextmail.sh/docs/python/reference/billing#listInvoices); Ruby [`billing.list_invoices`](https://nextmail.sh/docs/ruby/reference/billing#listInvoices); PHP [`billing->listInvoices`](https://nextmail.sh/docs/php/reference/billing#listInvoices); Go [`Billing.ListInvoices`](https://nextmail.sh/docs/go/reference/billing#listInvoices); Java [`billing().listInvoices`](https://nextmail.sh/docs/java/reference/billing#listInvoices); C# [`Billing.ListInvoicesAsync`](https://nextmail.sh/docs/csharp/reference/billing#listInvoices).

### `nextmail billing get-invoice`

Get the invoice of a charge

```bash
nextmail billing get-invoice <order-id> [flags]
```

Resolves with the link to the invoice of one charge, as a PDF, and its file name. An invoice that was not written yet is written first, which can take a few seconds. The link is signed by the billing provider, downloads the PDF and stops working after a while, so fetch it again rather than keeping it.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.

**Arguments**

- `<order-id>` (required): The charge id, as `listInvoices` returns it.

**Examples**

```bash
nextmail billing get-invoice order_4c1b257a
```

Print the raw JSON

```bash
nextmail billing get-invoice order_4c1b257a --json
```

Also available in: API [`GET /billing/invoices/{orderId}`](https://nextmail.sh/docs/api/reference/billing#get-billing-invoices-orderid); TypeScript [`nextmail.billing.getInvoice()`](https://nextmail.sh/docs/sdk/reference/billing#getInvoice); Python [`billing.get_invoice()`](https://nextmail.sh/docs/python/reference/billing#getInvoice); Ruby [`billing.get_invoice`](https://nextmail.sh/docs/ruby/reference/billing#getInvoice); PHP [`billing->getInvoice`](https://nextmail.sh/docs/php/reference/billing#getInvoice); Go [`Billing.GetInvoice`](https://nextmail.sh/docs/go/reference/billing#getInvoice); Java [`billing().getInvoice`](https://nextmail.sh/docs/java/reference/billing#getInvoice); C# [`Billing.GetInvoiceAsync`](https://nextmail.sh/docs/csharp/reference/billing#getInvoice).

### `nextmail billing save-invoice-details`

Save the billing details of a charge

```bash
nextmail billing save-invoice-details <order-id> --name <value> --line1 <value> --city <value> --country <value> [flags]
nextmail billing save-invoice-details <order-id> --data <json|@file|-> [flags]
```

Saves the name and address billed on a charge, as the Billing address dialog does, keeps the address for later charges, and starts writing its invoice. `invoice` is `ready` when the charge already had one, `started` when it is being written, and `refused` with the reason in `message`.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:write`.
- Needs a sign-in.

**Arguments**

- `<order-id>` (required): The charge id, as `listInvoices` returns it.

**Flags**

- `--name <value>`: Who is billed, up to 200 characters. Required, here or in `--data`.
- `--line1 <value>`: The street address, up to 200 characters. Required, here or in `--data`.
- `--line2 <value>`: A flat, suite or building, up to 200 characters.
- `--city <value>`: Up to 120 characters. Required, here or in `--data`.
- `--postal-code <value>`: Up to 40 characters.
- `--state <value>`: The state or region, up to 60 characters. In the US and Canada, its two-letter code.
- `--country <value>`: A two-letter ISO 3166 code, one of those `listCountries` returns. Required, here or in `--data`.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

The required values only

```bash
nextmail billing save-invoice-details order_4c1b257a --name 'Acme Ltd' --line1 '1 Market Street' --city London --country GB
```

With optional flags

```bash
nextmail billing save-invoice-details order_4c1b257a --name 'Acme Ltd' --line1 '1 Market Street' --city London --country GB --postal-code 'EC1A 1AA'
```

Read the whole body from a JSON file

```bash
nextmail billing save-invoice-details order_4c1b257a --data @billing.json
```

Also available in: API [`PUT /billing/invoices/{orderId}/details`](https://nextmail.sh/docs/api/reference/billing#put-billing-invoices-orderid-details); TypeScript [`nextmail.billing.saveInvoiceDetails()`](https://nextmail.sh/docs/sdk/reference/billing#saveInvoiceDetails); Python [`billing.save_invoice_details()`](https://nextmail.sh/docs/python/reference/billing#saveInvoiceDetails); Ruby [`billing.save_invoice_details`](https://nextmail.sh/docs/ruby/reference/billing#saveInvoiceDetails); PHP [`billing->saveInvoiceDetails`](https://nextmail.sh/docs/php/reference/billing#saveInvoiceDetails); Go [`Billing.SaveInvoiceDetails`](https://nextmail.sh/docs/go/reference/billing#saveInvoiceDetails); Java [`billing().saveInvoiceDetails`](https://nextmail.sh/docs/java/reference/billing#saveInvoiceDetails); C# [`Billing.SaveInvoiceDetailsAsync`](https://nextmail.sh/docs/csharp/reference/billing#saveInvoiceDetails).

### `nextmail billing list-add-ons`

List add-ons

```bash
nextmail billing list-add-ons [flags]
```

Resolves what can be bought on top of the plan, today the dedicated sending IP: whether it is for sale, its price per IP a month in `priceCents`, whether the workspace has it and when it ends, the IPs it brought, and `eligibility`, which says whether the workspace qualifies. A dedicated IP needs the Business or Enterprise plan and at least 100,000 emails sent in a month, because below that volume it delivers worse than the shared IPs.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:read`.
- Needs a sign-in.

**Examples**

```bash
nextmail billing list-add-ons
```

Print the raw JSON

```bash
nextmail billing list-add-ons --json
```

Also available in: API [`GET /billing/add-ons`](https://nextmail.sh/docs/api/reference/billing#get-billing-add-ons); TypeScript [`nextmail.billing.listAddOns()`](https://nextmail.sh/docs/sdk/reference/billing#listAddOns); Python [`billing.list_add_ons()`](https://nextmail.sh/docs/python/reference/billing#listAddOns); Ruby [`billing.list_add_ons`](https://nextmail.sh/docs/ruby/reference/billing#listAddOns); PHP [`billing->listAddOns`](https://nextmail.sh/docs/php/reference/billing#listAddOns); Go [`Billing.ListAddOns`](https://nextmail.sh/docs/go/reference/billing#listAddOns); Java [`billing().listAddOns`](https://nextmail.sh/docs/java/reference/billing#listAddOns); C# [`Billing.ListAddOnsAsync`](https://nextmail.sh/docs/csharp/reference/billing#listAddOns).

### `nextmail billing start-add-on-checkout`

Start a checkout for an add-on

```bash
nextmail billing start-add-on-checkout --add-on <value> [flags]
nextmail billing start-add-on-checkout --data <json|@file|-> [flags]
```

Starts buying an add-on, as the button under Billing does, and resolves with the link to the checkout. Nothing is charged until the person pays there. Once it is paid the dedicated IP is set up and warmed up, which `sending.listDedicatedIps` shows.

Nothing is paid through the API: the person pays on the billing provider's page the link opens, as they do from the app.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:write`.
- Needs a sign-in.

**Flags**

- `--add-on <value>`: The add-on to buy: `dedicated-ip`. Required, here or in `--data`.
- `--theme <value>`: `light` or `dark`, for the page the link opens.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

```bash
nextmail billing start-add-on-checkout --add-on dedicated-ip
```

Read the whole body from a JSON file

```bash
nextmail billing start-add-on-checkout --data @billing.json
```

Also available in: API [`POST /billing/add-ons/checkout`](https://nextmail.sh/docs/api/reference/billing#post-billing-add-ons-checkout); TypeScript [`nextmail.billing.startAddOnCheckout()`](https://nextmail.sh/docs/sdk/reference/billing#startAddOnCheckout); Python [`billing.start_add_on_checkout()`](https://nextmail.sh/docs/python/reference/billing#startAddOnCheckout); Ruby [`billing.start_add_on_checkout`](https://nextmail.sh/docs/ruby/reference/billing#startAddOnCheckout); PHP [`billing->startAddOnCheckout`](https://nextmail.sh/docs/php/reference/billing#startAddOnCheckout); Go [`Billing.StartAddOnCheckout`](https://nextmail.sh/docs/go/reference/billing#startAddOnCheckout); Java [`billing().startAddOnCheckout`](https://nextmail.sh/docs/java/reference/billing#startAddOnCheckout); C# [`Billing.StartAddOnCheckoutAsync`](https://nextmail.sh/docs/csharp/reference/billing#startAddOnCheckout).

### `nextmail billing cancel-add-on`

Cancel an add-on

```bash
nextmail billing cancel-add-on <add-on> [flags]
```

Cancels an add-on. It stays until the end of the month already paid for, which `endsAt` gives. Then the dedicated IP is released and mail leaves through the shared IPs again.

Billing belongs to the owner of the workspace: an API key acts for the owner, and an OAuth access token reaches billing only when the owner connected the app with every address. A token that acts for a member is 403 `owner_only`, and a key or token limited to particular addresses or domains is 422 `capability_unsupported`.

- Scopes: `billing:write`.
- Needs a sign-in.
- Asks you to confirm.

**Arguments**

- `<add-on>` (required): The add-on to cancel: `dedicated-ip`.

**Examples**

```bash
nextmail billing cancel-add-on dedicated-ip
```

Skip the confirmation, for scripts

```bash
nextmail billing cancel-add-on dedicated-ip --yes
```

Also available in: API [`DELETE /billing/add-ons/{addOn}`](https://nextmail.sh/docs/api/reference/billing#delete-billing-add-ons-addon); TypeScript [`nextmail.billing.cancelAddOn()`](https://nextmail.sh/docs/sdk/reference/billing#cancelAddOn); Python [`billing.cancel_add_on()`](https://nextmail.sh/docs/python/reference/billing#cancelAddOn); Ruby [`billing.cancel_add_on`](https://nextmail.sh/docs/ruby/reference/billing#cancelAddOn); PHP [`billing->cancelAddOn`](https://nextmail.sh/docs/php/reference/billing#cancelAddOn); Go [`Billing.CancelAddOn`](https://nextmail.sh/docs/go/reference/billing#cancelAddOn); Java [`billing().cancelAddOn`](https://nextmail.sh/docs/java/reference/billing#cancelAddOn); C# [`Billing.CancelAddOnAsync`](https://nextmail.sh/docs/csharp/reference/billing#cancelAddOn).
