Invoices Lifecycle
This page defines invoice behavior shared across product layers.
Invoice Status
pending: waiting for paymentcompleted: payment detected (balance >= requiredRaw)cancelled: manually deleted or expired without paymentwithdrawn: funds moved from payment address to owner
Lifecycle Flow
- Create invoice
- Client flow:
POST /invoices - Integration flow:
POST /integration/invoices
- Payment tracking
- Background monitor checks balances periodically.
- Manual status checks can trigger immediate re-check.
- Completion and withdrawal
- When funds satisfy required amount, invoice becomes
completed. - Invoice may enter withdrawal queue based on backend policy.
- After confirmed transfer to owner, invoice is
withdrawn.
- Cancel or expiration
- Soft delete sets invoice to
cancelledand removes active monitoring.
Important Fields
requiredRaw: required amount in raw token unitsbalanceRaw: current paid amount in raw token unitsmetaBalance: human-readable balance snapshotlastCheckedAt: last on-chain check timestamp
Operational Notes
- A previously
withdrawninvoice can be re-queued if new qualifying funds arrive. - Always use string/BigInt for on-chain values in clients.