Need more? 500 credits for $10, any time. They never expire.Credit packs let a customer who runs out buy more through Stripe Checkout and keep working, whether they’re on a plan or not. A credit pack is a one-time purchase: a fixed
creditAmount for a priceCents. Customers buy one when they run out before their plan renews, or instead of a plan. Pack credits never expire. A pack adds to the shared credit pool and pays for every credits feature.
Packs or top-ups. A pack is a fixed amount at a fixed price, the button that says “500 credits for $10”. To let customers enter any amount, or to buy automatically with their saved card when the balance runs low, use top-ups and auto top-ups. An auto top-up can buy one of your packs.
One thing, two names. In ledger.config.ts, packs go in creditPacks. The JSON file and the API call them add-ons: addOns, each with type: "credit_pack", served at /v1/add-ons and sold with addOnId. The TypeScript config also accepts addOns; use one of the two names in a file.
The catalog
Sell it
Offer the pack whencheck returns allowed: false with reason: "insufficient_credits", or track returns 409 insufficient_credits. To offer it before they run out, listen for the balance.low webhook: it fires when a use takes the balance to or below your threshold. Customers on any plan, or none, can buy one. Attach it with addOnId and redirect to Checkout:
{ checkoutUrl, addOnPurchaseId }. Ledger grants the credits when Stripe’s signed checkout.session.completed event confirms the payment; Stripe also sends the customer an invoice with a line such as “Top-up – 500 credits”. The next check shows them in availableCredits. GET /v1/customers/purchases lists the purchase history. Checkout and attach covers redirects and testing.
Packs can also be managed in the dashboard under Add-ons, or with the add-on endpoints.
Rules
creditAmountis a whole number above 0, andpriceCentsis above 0.- Fixed, through Checkout. A pack sells its
creditAmountfor itspriceCents, and each attach opens a Stripe Checkout. An auto top-up buys a pack with the saved card instead. - Spend order. Balances says when pack credits are spent.
- One open pack Checkout at a time. Attaching the same pack returns the same URL. Attaching a different pack expires the unpaid Checkout and opens a new one, and returns
409 purchase_pendingwhile the first one is being paid. Stripe expires an unpaid Checkout after 24 hours. - Prices lock while a Checkout is open. Changing the pack’s
creditAmountorpriceCentsreturns409 purchase_pendinguntil it completes or expires. Renaming is fine. - Removing a pack from the file archives it. It stops new sales, and a Checkout already open can still complete.
- Refunds happen in Stripe. A full refund expires the pack’s unused credits; credits already spent stay spent, so the balance never goes negative. A partial refund leaves the credits as they are. A lost dispute expires the unused credits as a full refund does. See Renewals and lifecycle.
Related
- Credits: the features packs pay for.
- Top-ups and auto top-ups: any amount, or bought automatically when the balance runs low.
- Overage: bill extra credits later instead of selling them up front.
- Lifetime plans: credits that never expire, sold as a plan.