Invoices
Checkout flow (recommended)
- Customer clicks "Pay" in your UI.
- Server:
POST /api/invoiceswith{ chain, token, amount, metadata }. - Show the returned address to the customer (QR + copyable).
- Customer sends payment from their wallet.
- Cassia observes the tx and calls your webhook with
invoice.paid. - Grant access (digital goods) or start fulfillment (physical goods). For high-value orders, wait for
invoice.confirmed— see When to grant access.
Polling fallback
If you can't expose a public webhook yet, poll GET /api/invoices/:id every 5–10 seconds while the invoice is pending. Move to webhooks before shipping anything real — polling loses state on server restart and costs more at scale.
Handling underpaid
When the customer sends less than amount, the invoice enters underpaid and fires invoice.underpaid. Payload includes received. Three options:
- Partial fulfillment — grant proportional access.
- Refund — send funds back from your wallet (Cassia can't do this for you — see non-custodial).
- Ask for the remainder — out of band; create a new invoice for the difference.
Endpoints
- POST
/api/invoicescreate. - GET
/api/invoiceslist, paginated, filterable bystatus,chain,token. - GET
/api/invoices/:idfetch one with transaction log and webhook delivery history. - POST
/api/invoices/:id/cancelcancel unpaid invoice. Idempotent on already-cancelled invoices. Throws400if the invoice ispaid,confirmed, orexpired. Onlypendingandunderpaidare cancellable. Also400while a payment for the invoice is being verified: "Cannot cancel this invoice yet — a payment for it is being verified. It will be settled or expire on its own." - GET
/api/invoices/export.csvRFC 4180 CSV of all invoices matching filters. Query:status,chain,token,include_testnet=true. Streams the full filtered result; no pagination cursor needed at current volumes. - POST
/api/invoices/acknowledgedismiss underpaid alerts on the dashboard.
POST /api/invoices errors
| Status | error | Meaning | What to do |
|---|---|---|---|
503 | issuance_paused | Creation is temporarily unavailable on this network. Nothing was created. | Retry later. |
503 | address_issuance_unavailable | A deposit address could not be prepared. Nothing was created. | Retry later; contact support if it persists. |
Updated . For integration help, email [email protected]