Wallet balance and ledger
GET /api/v1/billing/balance returns the prepaid wallet as dollars, whole cents, and micro-cents, alongside the outbound-pause flags billing alerts can set. Poll it before a send to check available funds.
GET /api/v1/billing/transactions pages through the wallet ledger — top-ups, spend debits, refunds, and adjustments — newest first, with next_cursor for paging.
Top up the wallet
POST /api/v1/billing/balance/top-up returns a hosted Stripe Checkout URL in the locally-hosted checkoutUrl field; the wallet is credited once the payment settles. The Idempotency-Key header dedupes retries, so a repeated request returns the same session instead of charging twice.
Plan checkout and subscription management
POST /api/v1/billing/checkout starts a Stripe Checkout session for a subscription-plan change and returns the hosted checkoutUrl; requests are idempotent for 60 seconds per organization and plan, so a double-click returns the same session URL.
POST /api/v1/billing/portal opens a Stripe customer-portal session so the customer can manage payment methods, subscription, and invoices. Read GET /api/v1/billing/status first and only offer this (or plan checkout above) when can_manage is true.
Auto top-up configuration
PUT /api/v1/billing/auto-topup charges the saved payment method off-session whenever the balance falls to the threshold. recharge_amount_minor must exceed threshold_minor.
Billing alerts
POST /api/v1/billing/alerts/ creates a spend or balance threshold. At least one email or SMS recipient is required; action_on_hit can be notify, pause_outbound, or block_outbound.