Flow
Hover a primitive to trace it · click to jump to its code- Catalog1
Create the product
A product is the catalog entry for what you sell. It holds no pricing: prices point at it.
products=v1curl https://api.paid.ai/v1/products \ -H "Authorization: Bearer $PAID_API_KEY" \ -H "Paid-Version: 2026-11-01" \ -H "Paid-Beta: products=v1" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "externalId": "support_agent", "name": "Support agent", "productCode": "HW-AGENT" }' - 2
Create the Agent replies meter
Counts every
ticket.repliedevent. A meter decides what's billable from the events you send.meters=v1curl https://api.paid.ai/v1/meters \ -H "Authorization: Bearer $PAID_API_KEY" \ -H "Paid-Version: 2026-11-01" \ -H "Paid-Beta: meters=v1" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "key": "agent_replies", "name": "Agent replies", "eventNames": [ "ticket.replied" ], "measure": { "type": "events", "events": { "aggregation": { "type": "count" }, "unit": "reply" } } }' - 3
Price agent replies
A usage price charges for what the meter measures. Amounts are decimal strings in minor units. The response's ID,
prc_7Kd2Pwhere, is what orders refer to.prices=v1curl https://api.paid.ai/v1/prices \ -H "Authorization: Bearer $PAID_API_KEY" \ -H "Paid-Version: 2026-11-01" \ -H "Paid-Beta: prices=v1" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "product": "support_agent", "currency": "usd", "displayName": "Agent replies", "type": "usage", "usage": { "meter": "agent_replies", "pricing": { "type": "perUnit", "perUnit": { "unitAmount": "50" } } } }' - Customer4
Create the customer
The company you bill. Anywhere the API asks for a customer it takes Paid's
cus_ID or yourexternalId.customers=v1curl https://api.paid.ai/v1/customers \ -H "Authorization: Bearer $PAID_API_KEY" \ -H "Paid-Version: 2026-11-01" \ -H "Paid-Beta: customers=v1" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "externalId": "northwind", "name": "Northwind Traders", "email": "billing@northwind.example", "currency": "usd" }' - Order5
Create the order
An order starts as a draft and bills nothing until it's activated.
orders=v1curl https://api.paid.ai/v1/orders \ -H "Authorization: Bearer $PAID_API_KEY" \ -H "Paid-Version: 2026-11-01" \ -H "Paid-Beta: orders=v1" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "customer": "northwind", "startsAt": "2026-11-01T00:00:00Z", "billingCycle": { "interval": "month" }, "lines": [ { "type": "price", "price": { "price": "prc_7Kd2Pw" } } ] }' - 6
Activate the order
The request has no body. It returns
200once active, or202while it'sactivating.orders=v1curl -X POST https://api.paid.ai/v1/orders/ord_PxUHJr/activate \ -H "Authorization: Bearer $PAID_API_KEY" \ -H "Paid-Version: 2026-11-01" \ -H "Paid-Beta: orders=v1" \ -H "Idempotency-Key: $(uuidgen)" - Usage7
Send a ticket.replied event
One per reply. The meter counts them. Use an ID your system already has as the
dedupeKey, so a retried send is never counted twice.events=v1curl https://api.paid.ai/v1/events \ -H "Authorization: Bearer $PAID_API_KEY" \ -H "Paid-Version: 2026-11-01" \ -H "Paid-Beta: events=v1" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "eventName": "ticket.replied", "customer": "northwind", "product": "support_agent", "dedupeKey": "reply_91c2e7", "correlationId": "ticket_4410", "payload": { "channel": "email", "ticketId": "4410" } }' - Reporting8
See usage and spend
Each row has a
quantityandspendper meter. Rows stayprovisionaluntil the period's invoice settles them.usage_summaries=v1curl -G https://api.paid.ai/v1/usage-summaries \ -H "Authorization: Bearer $PAID_API_KEY" \ -H "Paid-Version: 2026-11-01" \ -H "Paid-Beta: usage_summaries=v1" \ --data-urlencode "customer=northwind" \ --data-urlencode "meters[]=agent_replies" \ --data-urlencode "startsAt=2026-11-01T00:00:00Z" \ --data-urlencode "endsAt=2026-12-01T00:00:00Z" \ --data-urlencode "granularity=month"