# Billing

> Distilled is prepaid: top up a balance and it pays for phones, 30 days at once or by the minute. The free trial, automatic top-ups and the billing API.

Distilled is prepaid. You top up a balance by card, and it pays for your phones, and for traffic and agent use past what they include. Each phone has a `plan`, chosen when you allocate it and changed with `PUT /v1/phones/{id}/plan`. Top-ups and every charge are listed in the console, under Transactions.

## Plans

`monthly` is $50 for 30 days, taken from your balance at once. Nothing more is charged for the phone until `paidThrough`, however much it runs, and stopping or releasing it gives nothing back. Nothing renews by itself: when the 30 days end the phone is stopped, with its apps and data kept, until you renew it in the console or with `POST /v1/phones/{id}/renew`. Renew before the end and the new 30 days follow the paid ones. Time the phone could not run because of a fault on our side is added to its 30 days.

`payg` charges each minute the phone runs: $0.28 an hour, which comes to $200 if it runs 30 days without stopping. A stopped phone costs nothing. It is the plan a phone gets when you name none. A month already paid for is kept when you change plan, and minutes are charged only once it ends.

## Adding phones

Adding phones needs a balance that covers them, $50 for each monthly one and $6.67, which is 24 hours, for each one charged by the minute, on top of what your running phones need in those hours.

## Free trial

A new workspace can start a free trial from the console: $7 of credit and $1 of agent use, to use within 7 days. Starting it checks a card without charging it, and each card gets one trial. Nothing is charged until the trial ends. If the credit runs out first, phones pause until you top up or the trial ends. From then, the card adds $50 whenever your balance covers less than what the phones running or waiting for credit need in the next 6 hours, and never when none are. Turn this off on the Usage page, or with `PUT /v1/billing/auto-top-up`.

## Endpoints

- `GET /v1/billing` (scope `billing:read`): Your balance in US cents, a phone's prices, how many phones are running on each plan, what they need in the next 24 hours, and the latest entries, newest first. Pass `nextBefore` back as `before` for older ones; `limit` takes up to 200.
- `PUT /v1/billing/auto-top-up` (scope `billing:write`): Turns the trial card's automatic top-up off or on with `{ enabled }`. `autoTopUp` in `/v1/billing` says which card it is, how much it adds, and `startsAt`, the day it can first charge.
- `POST /v1/billing/top-ups` (scope `billing:write`): Starts a top-up of `{ cents, method }`, from 1,000 to 100,000 cents, and answers 201 with the `url` of a payment page to send the payer to. `method` is `card` (the default) or `crypto`, when `topUpMethods` in `/v1/billing` lists it. The balance goes up once the payment is confirmed.
- `POST /v1/billing/card/payments` (scope `billing:write`): Starts a card top-up of `{ cents }` to collect in a page of your own, and answers 201 with the `clientSecret` and `publishableKey` that Stripe's card form is set up with.
- `GET /v1/billing/card/payments/{id}` (scope `billing:read`): Where the card payment stands: `waiting`, `processing`, `paid` or `failed`, with Stripe's receipt page once it is paid.
- `GET /v1/billing/crypto/currencies` (scope `billing:read`): The coins a crypto top-up can be paid in, each with its networks.
- `POST /v1/billing/crypto/payments` (scope `billing:write`): Starts a crypto top-up of `{ cents, currency, network }` to show in a page of your own, and answers 201 with the `address`, the `payAmount` to send and when it expires.
- `GET /v1/billing/crypto/payments/{id}` (scope `billing:read`): Where the payment stands: `waiting`, `confirming`, `underpaid`, `paid` or `expired`, with the transaction that paid it once one was seen.

Source: https://distilled.cx/docs/billing/
