← Docs

Payments & Affiliates

TeachRepo handles Stripe checkout, paywall enforcement, and a simple affiliate link system — all without you writing a line of payment code.

Pricing models

🆓
Free

Set price_cents: 0 in course.yml. Anyone can enroll.

💳
One-time

Set a price in cents (e.g. 4900 = $49). Stripe checkout handles the rest.

🔜
Coming soon

Subscriptions and bundles are on the roadmap.

How checkout works

  1. 1Learner clicks "Enroll" on a paid course page
  2. 2TeachRepo creates a Stripe Checkout Session via POST /api/checkout
  3. 3Learner completes payment on Stripe's hosted page
  4. 4Stripe fires a webhook to POST /api/webhooks/stripe
  5. 5Webhook verifies signature, creates an enrollment row in Supabase
  6. 6Learner is redirected back and can access all paid lessons

Platform fees

0%platform fee on self-hosted / OSS tier
5%platform fee on hosted SaaS + marketplace listing

Stripe's standard processing fee (2.9% + 30¢) applies to all transactions. TeachRepo's platform fee is taken from the payout, not charged separately.

Affiliate links

Give affiliates a unique referral link. When a learner purchases through that link, the affiliate earns a configurable commission.

https://teachrepo.com/courses/git-for-engineers?ref=AFFILIATE_CODE

How it works: The ?ref= parameter is captured at checkout and stored in the referrals table. Affiliates can see their clicks and conversions in the dashboard.

Commission: Set per-affiliate in the Affiliates tab of your dashboard. Default: 30% of the sale price.

Payouts: Currently manual (export a CSV from the dashboard). Automated payouts via Stripe Connect are on the roadmap.

Test purchases

Set the environment variable ENABLE_PURCHASE_SIMULATION=true to enable the POST /api/enroll/simulate endpoint. Use this to test the enrolled state without going through Stripe.

curl -X POST https://yoursite.com/api/enroll/simulate \
  -H "Authorization: Bearer <jwt>" \
  -H "Content-Type: application/json" \
  -d '{"courseId": "uuid-here"}'

⚠ Disable this in production — it bypasses payment validation.

Next: Self-Hosting →← Quizzes