💳 Credit System

BetterLearn uses a credit-based system for AI features. Users purchase credits and spend them on:

  • Quiz Generation: Creating quizzes from documents or topics
  • AI Tools: Using Educator and Student tools
  • AI Assistant: Chat interactions and generations
  • Image Generation: AI-generated images

🎛️ Managing Pricing Plans

💡
Admin Panel

Pricing plans are managed entirely from the Admin Panel → Pricing section. No code changes needed!

Creating Plans

  1. Go to Admin Panel → Pricing
  2. Click "Add New Plan"
  3. Configure: Name, Credits, Price, Features
  4. Save and the plan auto-syncs with Stripe

Plan Configuration

FieldDescription
NameDisplay name (e.g., "Starter Pack")
CreditsNumber of credits included
PriceUSD price (Stripe handles conversion)
FeaturesFeature list shown on pricing card
PopularMark as recommended/highlighted
ActiveShow/hide on pricing page

⚡ Credit Costs

Default credit costs per action:

ActionCredits
Quiz generation (per quiz)1-3 credits
AI Tool usage1 credit
AI Assistant message1 credit
Image generation2 credits
⚠️
Credit Cost Configuration

Credit costs are defined in the codebase. Modify lib/credit-validation.ts to adjust costs.

🔄 Stripe Integration

When a user purchases credits:

  1. User selects a plan on the Subscription page
  2. Redirected to Stripe Checkout
  3. Payment processed by Stripe
  4. Webhook triggers credit addition
  5. Credits appear in user's wallet

🎁 Free Credits

New users receive free credits on signup (configurable in Site Settings).

Admin Credit Management

Admins can manually adjust user credits:

  1. Admin Panel → Users
  2. Find user and click "Manage Credits"
  3. Add or remove credits

📊 Credit Analytics

Track credit usage in Admin Panel → Analytics:

  • Total credits purchased
  • Credits consumed by feature
  • Revenue trends
  • User spending patterns