Buy credits
buy_creditsTop up your account with credit packs. List packs, get a quote, and charge your saved card or receive a Stripe checkout link.
Instructions
Out of credits? Top up with a credit PACK. Call with no argument to list the available packs (id · credits · price). If the account has a saved card and you have billing-admin rights, calling with pack quotes the exact charge and calling again with confirm:true AND the quote's quote_token charges the saved card instantly (same one-click top-up as the app — no redirect). If there's no saved card yet, you get a Stripe checkout URL to hand your human for the FIRST purchase; their card saves for one-click after that. Packs only; subscriptions are managed by a person in Settings → Billing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pack | No | the pack id to buy (e.g. pack-2k) — omit to list the available packs first | |
| confirm | No | set true to actually charge the saved card for `pack` (required for the one-click charge; ignored on the checkout-link path) | |
| quote_token | No | the quoteToken returned by the quote step — REQUIRED (with confirm:true) to charge; it binds the exact pack + price you quoted (10-minute validity) and makes a retried confirm idempotent |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | true when a one-click top-up charge succeeded | |
| url | No | Stripe checkout URL for a first purchase (no saved card yet) | |
| packs | No | available credit packs ({id, credits, priceUsd}) when listing | |
| quote | No | the one-click charge quote ({packId, credits, priceUsd, card}) awaiting confirm:true | |
| packId | No | the pack id the checkout link buys | |
| credits | No | credits added by a completed top-up (or bought by the checkout link) | |
| amountUsd | No | USD amount of the checkout link |