Skip to content
Try Hanzo
Language: English (United States)

Hanzo Billing

Billing & Metering

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.

Invoice

cus_abc123
  • Subscriptionprice_api_metered$20.00
  • api_requests× 120,000 · $0.0020$240.00
  • discount0%−$0.00
  • Taxcalculated on the invoice · 8%$20.80
Preview one before it is issued.$280.80

The objects you bill with

What is Hanzo Billing

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

billing.usage.record7

Meterapi_requests

Period 1open

Invoicecus_abc123Draft
  • Subscriptionprice_api_metered
  • api_requestsmetering…
  • Taxcalculated on the invoice

Preview one before it is issued.

  1. Plans and prices

    01 / 03

    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.

    Planapi
    • Price 14
    • Price 22
  2. Meters

    02 / 03

    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.

  3. Invoices

    03 / 03

    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.

What the endpoint gives you

Capabilities

Report the use, then charge for it

Get started

Send your first meter event

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

  • gatewayReady
  • payments-apiReady
  • checkout-webBuilding
  • docs-siteReady

The service the session above is changing.

api.hanzo.ai/v1/billingOpen in the console ↗
Example project. Every name in it is one you would give your own.
typescript
import { Hanzo } from '@hanzo/billing';

const billing = new Hanzo({ apiKey: process.env.HANZO_API_KEY });

// Report usage in real time
await billing.usage.record({
  customer: 'cus_abc123',
  meter: 'api_requests',
  value: 1,
  timestamp: new Date(),
});

// Subscribe with metered pricing
await billing.subscriptions.create({
  customer: 'cus_abc123',
  items: [{ price: 'price_api_metered' }],
  payment_behavior: 'default_incomplete',
});

Paste and ship

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

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

Get Billing

Metered billing engine

License: Apache-2.0hanzoaiDeploy to Cloud