# Hanzo Billing — Hanzo AI

> Recurring subscriptions, usage-based pricing, prorated upgrades, dunning, and tax.

Billing & Metering

# Hanzo Billing

Subscriptions, usage, invoices. Charge a fixed price, charge for what someone used, or charge for both on the same invoice. Plans, prices, meters, coupons and credits are separate objects, so a pricing change is a new price rather than a migration — and your servers never hold a card number to do any of it.

[Get Started](https://docs.hanzo.ai/docs/billing)[GitHub](https://github.com/hanzoai)

Paste and ship

Paste this into any agent. It reads the skill manifest and calls Billing from there.

Agent promptapi /v1/billingCopy

```
Read https://hanzo.ai/skill.md and use Hanzo Billing in my project. Start with: hanzo billing balance
```

What is Hanzo Billing

## The objects you bill with

Small pieces that compose, rather than one plan type that has to cover every case.

01

### Plans and prices

A plan says what someone gets. A price says what it costs. Keeping them apart is what lets you change a price without touching anyone already on the old one.

02

### Meters

Post an event when something is used and the meter aggregates it. The invoice reads the meter at the end of the period, so nobody has to add up rows by hand.

03

### Invoices

Line items assembled from the subscription and the meters, with tax calculated on the invoice itself. Preview one before it is issued, which is when a pricing mistake is still cheap.

Capabilities

## What the endpoint gives you

### Credits and refunds

Issue credit against a balance, or refund a payment that already settled. Both leave a record, because a customer arguing about a bill is really arguing about a history.

### Coupons and discounts

Apply one to a subscription or to a single invoice. A discount is an object on the invoice rather than an adjusted number, so the reason the total changed is still legible.

### Webhooks

The provider tells us a payment settled and we tell you. One endpoint per provider, so adding a second processor does not mean a second integration on your side.

Get started

## Report the use, then charge for it

typescript

```
import { Hanzo } from &#x27;@hanzo/billing&#x27;; const billing = new Hanzo({ apiKey: process.env.HANZO_API_KEY }); // Report usage in real time await billing.usage.record({ customer: &#x27;cus_abc123&#x27;, meter: &#x27;api_requests&#x27;, value: 1, timestamp: new Date(), }); // Subscribe with metered pricing await billing.subscriptions.create({ customer: &#x27;cus_abc123&#x27;, items: [{ price: &#x27;price_api_metered&#x27; }], payment_behavior: &#x27;default_incomplete&#x27;, });
```

[Read the docs](https://docs.hanzo.ai/docs/billing)[View on GitHub](https://github.com/hanzoai)

## Send your first meter event

Report what someone used, and let the invoice read the meter at the end of the period.

[Read the docs](https://docs.hanzo.ai/docs/billing)[View on GitHub](https://github.com/hanzoai)

## Start building with Billing

[Get your API key](https://platform.hanzo.ai/api-keys)

One API key. One credit balance. Every primitive.

Related capabilities

[Overview](https://hanzo.ai/overview)[EvalsMeasure model & agent quality](https://hanzo.ai/cloud/evals)[LogsSearch every line](https://hanzo.ai/cloud/logs)

## Open source

License: Apache-2.0[hanzoai](https://github.com/hanzoai)

## Get Billing

Metered billing engine

[Deploy to Cloud](https://platform.hanzo.ai/deploy)
