---
title: "QuotaStack Cookbook"
description: "Focused recipes for common billing tasks — granting credits, stacking packs, free-tier bonuses, auto-buying plans, and building a pricing matrix."
---

# QuotaStack Cookbook

Focused recipes for common billing tasks. Each recipe has a full agent-readable page at the same URL + `.md`.

- [Plan Purchase as a Usage Event](/docs/cookbook/wallet-and-plans.md): Buy plans by debiting wallet credits and granting time-limited plan credits — a two-step credit operation with deterministic idempotency.
- [Stacking Multiple Credit Packs](/docs/cookbook/pack-stacking.md): How credit blocks from multiple purchases coexist and burn in deterministic priority order — no merging, no special handling.
- [Granting Free Credits on Signup or Action](/docs/cookbook/free-tier-credits.md): Patterns for signup bonuses, per-action grants, and time-limited trials using deterministic idempotency keys.
- [Auto-Purchasing Plans When Credits Run Out](/docs/cookbook/auto-buy-from-wallet.md): Automatically buy the next plan from the user's wallet when plan credits are exhausted — zero friction, no paywall interruption.
- [Setting Up a SaaS Pricing Matrix with Typed Entitlements](/docs/cookbook/entitlement-types-setup.md): End-to-end walkthrough of defining typed billable metrics and attaching them to plan variants to build a complete Free vs Pro feature matrix.
- [End-to-End Billing Setup: From Zero to Working Credits in 10 Steps](/docs/cookbook/end-to-end-billing.md): Complete walkthrough building a working billing system with Acme Chat — metric, metering rule, plan, variant, customer, subscription, and usage in one linear sequence.
- [Billing Overage in Arrears](/docs/cookbook/overage-billing-in-arrears.md): Let customers keep working past their credit balance, then invoice the recorded overage each cycle through your own PSP. QuotaStack stays payment-agnostic.
- [Importing Existing Customers (Legacy Cutover)](/docs/cookbook/import-existing-customers.md): How to move mid-plan customers, remaining wallets, trials, and packs into QuotaStack without double-granting or resetting billing periods.
- [Notifying Users Before the Wallet Runs Dry](/docs/cookbook/low-balance-alerts.md): Use credit.low_balance and credit.exhausted to warn customers early and react when they hit zero, without polling balances.
- [Connect Dodo Payments](/docs/cookbook/dodo-payment-connector.md): Configure sandbox and live Dodo connections, register callbacks, map products, create hosted checkout, and recover payment events safely.
- [Generate a Client from the OpenAPI Spec](/docs/cookbook/generate-a-client.md): There is no official SDK yet. Generate a typed client from the published spec, and handle the two things a generator will not do for you.
