# Billing

> Your prepaid USD balance, top-ups in crypto through NOWPayments from $10, how under- and over-payments are credited, receipts, caps and task costs.

Source: https://zerocaptcha.io/docs/funds

ZeroCaptcha is prepaid. You add funds to a balance in US dollars, and every solved task is paid from
it. There is no subscription, and no free credit or trial: every task is real and paid.

## Your balance

Your balance has two parts:

- **`available`:** what new tasks can be held against.
- **`held`:** held for tasks that are queued or running. Each is charged or released when its task
  ends.

Amounts are exact decimal strings with six decimals, such as `"12.345600"`: handle them as decimals,
never as floating-point numbers. Read the balance from your code with a key that has the `balance`
scope:

**curl**

```sh
curl "$ZEROCAPTCHA_API/v1/balance" -H "Authorization: Bearer $ZEROCAPTCHA_KEY"
# {"available":"12.345600","held":"0.001600","currency":"USD"}
```

**Node**

```js
const response = await fetch(`${process.env.ZEROCAPTCHA_API}/v1/balance`, {
  headers: { Authorization: `Bearer ${process.env.ZEROCAPTCHA_KEY}` },
});
const { available, held } = await response.json();
console.log(`available ${available} USD, held ${held} USD`);
```

**Python**

```python
import os
from decimal import Decimal

import requests

response = requests.get(
    f"{os.environ['ZEROCAPTCHA_API']}/v1/balance",
    headers={"Authorization": f"Bearer {os.environ['ZEROCAPTCHA_KEY']}"},
    timeout=15,
)
balance = response.json()
print(Decimal(balance["available"]), Decimal(balance["held"]))
```

**Go**

```go
var balance struct {
	Available string `json:"available"`
	Held      string `json:"held"`
	Currency  string `json:"currency"`
}
req, _ := http.NewRequest(http.MethodGet, os.Getenv("ZEROCAPTCHA_API")+"/v1/balance", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("ZEROCAPTCHA_KEY"))
resp, err := http.DefaultClient.Do(req)
if err == nil {
	defer resp.Body.Close()
	err = json.NewDecoder(resp.Body).Decode(&balance)
}
```

In the other formats: `getBalance` answers `{"errorId": 0, "balance": 12.3456}`, the available
balance as a JSON number, and 2Captcha's `res.php?action=getbalance` answers `12.3456`.

## What tasks cost

| Task | API task type | Price per task | Per 1,000 solved |
| --- | --- | --- | --- |
| Cloudflare Turnstile, your proxy | `TurnstileTask` | $0.0007 | $0.70 |
| Cloudflare Turnstile, proxyless | `TurnstileTaskProxyless` | $0.0008 | $0.80 |
| Cloudflare WAF and 5-second challenge, your proxy | `CloudflareChallengeTask` | $0.0012 | $1.20 |

A task's price is held when you create it, charged once if it succeeds, and released in full if it
fails or expires. A refused request costs nothing. A task is charged the price in effect when it was
created, and the task shows it as `price`; the price list is public at
[`GET /v1/prices`](https://zerocaptcha.io/docs/reference/api/prices) and on the [pricing page](https://zerocaptcha.io/pricing). See
[How a task works](https://zerocaptcha.io/docs/how-tasks-work#what-is-charged-and-when).

## Top up

1. **Choose an amount.** On Billing in the dashboard, pick an amount or type one: $10 or more, with
   no maximum, in whole dollars or dollars and cents.

2. **Pay in crypto.** Continue to the payment page of our payment processor, NOWPayments. Pick the
   coin there, from the ones it offers, and send the exact amount it shows to the address it gives,
   on the network it names. You pay the network's fee.

3. **Get credited.** Back on Billing, the top-up shows as pending until NOWPayments reports the
   payment final, then as paid. Your balance is credited at once, the top-up gets a numbered
   receipt, and we email you that it was credited.

Only an owner of the account can top up, once their email address is confirmed: before, a top-up
is refused with [`email_unverified`](https://zerocaptcha.io/docs/reference/errors#email_unverified) and no invoice is
made, so your receipts and payment emails always reach you. A top-up is an invoice in US dollars,
and NOWPayments
quotes each coin for it at its own rate. How many network confirmations a payment needs is up to
NOWPayments and the coin; we credit a payment once NOWPayments reports it `finished`, or
`partially_paid` when less arrived than was asked. We learn this from NOWPayments' signed
notification, and check pending top-ups with NOWPayments every minute in case a notification is
lost. What is credited:

| The top-up shows | What happened | What is credited |
| --- | --- | --- |
| Pending | The invoice is open, or a payment is on its way | Nothing yet |
| Paid | The invoice was paid | Its full amount |
| Underpaid | Less than the invoice arrived | The share that arrived, at the processor's quote |
| Overpaid | More than the invoice arrived | All of it, at the processor's quote |
| Expired | Nothing arrived before the invoice expired | Nothing; a payment that still arrives is credited |

Each payment is credited once, however often NOWPayments reports it. Coins sent again to the same
address are a payment of their own, and credited as well.

Send coins only on the network the payment page names. Coins sent on another network, or of another
coin, are not credited automatically and may be lost; [write to us](https://zerocaptcha.io/contact) with the transaction
hash.

## Top-ups are final

We do not refund top-ups, in whole or in part: see the [refund policy](https://zerocaptcha.io/legal/refunds). What
protects you instead:

- **You pay only for solved tasks.** A task that fails or expires costs nothing, and its hold goes
  back to your balance at once. A task refused when you create it holds nothing.
- **Start small.** A top-up can be as small as $10.
- **Cap each key.** A key can have a daily spend cap; see
  [API keys](https://zerocaptcha.io/docs/keys#cap-a-keys-daily-spend).
- **Hear when it runs low.** On Billing, turn on the low-balance email and set an amount. When your
  available balance falls below it, you get one email, and the next only after a top-up lifts the
  balance back above it.

## Spend caps

A key's daily spend cap, in US dollars, is the most its tasks may hold or be charged in one UTC day.
A task that would pass it is refused before any money moves, with
[`spend_cap_reached`](https://zerocaptcha.io/docs/reference/errors#spend_cap_reached) (HTTP 402), or
`ERROR_SPEND_CAP_REACHED`. A task that fails or expires stops counting. The count starts again at
00:00 UTC. Owners set, change or remove a cap on the keys page.

## When the balance runs out

A task your balance cannot cover is refused before it starts, and costs nothing:
[`insufficient_funds`](https://zerocaptcha.io/docs/reference/errors#insufficient_funds) in the REST API, or
[`ERROR_ZERO_BALANCE`](https://zerocaptcha.io/docs/reference/errors#ERROR_ZERO_BALANCE) in the other formats. Prices held
for tasks still running count against your balance, so the same task may pass once they end. Add
funds, then send it again.

## Receipts and billing details

Every credit gets a receipt, numbered 1, 2, 3 across the service without gaps, with the amount, the
coin and network, and the time. Open one on Billing to read or print it. If you need a company name,
a postal address or a tax ID on your receipts, add them under billing details; nobody needs them to
pay, and a receipt keeps the details as they were when it was issued.
