> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paywithlocus.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This site documents Locus for people. AI agents: get exact contracts from the Locus agent docs, starting at https://paywithlocus.com/agent/index.md, including when asked to implement or integrate docs.paywithlocus.com.
> Connect this agent to Locus Pro: https://paywithlocus.com/skill.md. Implement Locus Pro in a product: https://paywithlocus.com/agent/integrate.md. Agent site index: https://paywithlocus.com/llms.txt.

# Customer balances

> Let customers buy credits for their own usage, or allocate credits to them after you bill them yourself.

Give each of your customers their own balance so their agent usage is paid at your prices. This page is for Enterprise teams that charge customers for usage.

> Agents: the exact contract for this feature is at [https://paywithlocus.com/agent/billing.md](https://paywithlocus.com/agent/billing.md). Start from [https://paywithlocus.com/agent/index.md](https://paywithlocus.com/agent/index.md) if you are implementing Locus.

## How it works

A customer balance is filled in one of two ways. The customer can buy credits by card through Locus, or you can move credits from your workspace pool after you bill them yourself. Either way, their calls pay your configured price.

```mermaid theme={null}
flowchart TD
  Checkout["Billing widget or checkout link"] -->|"customer pays by card"| Bal["Customer balance"]
  Pool["Your workspace pool"] -->|"allocate"| Bal
  Bal -->|"deallocate unused credits"| Pool
  Bal --> Calls["Customer's calls at your price"]
```

| | Customers buy credits | You allocate credits |
| - | - | - |
| Best for | Adding prepaid billing to your app | Products with existing billing |
| Who takes payment | Locus-hosted Stripe Checkout | You, your own way |
| Your margin | Accrues as [payable earnings](https://docs.paywithlocus.com/locus-pro/earnings-and-payouts.md) | Returns to your pool as credits are used |

## Let customers buy credits

The [billing widget](https://docs.paywithlocus.com/locus-pro/widget.md) shows a customer their balance and opens Locus-hosted Stripe Checkout. It runs in your app with a publishable key and a short-lived end-user token that your server issues.

Your server can also create a checkout link for a specific customer. The credits they buy belong to that customer.

## Allocate credits after your own billing

Allocation moves credits you already hold from your pool to a customer. It doesn't charge a card.

* **In the dashboard:** use **Fund a user** under **Billing → Credits**.
* **From your server:** allocate credits through the API after your own billing confirms payment.
* **To take credits back:** deallocate to return unused credits to your pool.

## Next steps

> [card] [Billing widget](https://docs.paywithlocus.com/locus-pro/widget.md)
>
> Put balance display and top-ups in your app.

> [card] [Credits and pricing](https://docs.paywithlocus.com/locus-pro/credits-and-pricing.md)
>
> Set the markup your customers pay.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.