Skip to main content
Credits are the main usage meter across the apps. Payments can top them up, and app routes check balances before expensive actions run.

Where Credits Show Up

  • the dashboard sidebar
  • the account center
  • purchase flows
  • API routes for paid generation features

Credit Grants In The Repo

The repo currently grants:
  • credits-small -> 50 credits
  • credits-large -> 100 credits
Credit grants live in lib/payments/types.ts. Shared credit-pack labels, prices, and display metadata live in lib/payments/public-config.ts.

How Credits Change

  • new users start with a default balance from the database setup
  • app actions consume credits
  • failed generation paths can refund credits
  • successful credit purchases add more

Billing Flow

  1. User clicks a checkout link
  2. Provider sends a webhook
  3. The webhook is verified
  4. The purchase is stored in purchases
  5. The profile is updated
  6. If it is a credit purchase, credits are added automatically

Verification

Your billing setup is working if:
  • checkout succeeds
  • the purchase appears in the database
  • the credits number changes in the UI