Stripe
Stripe Integration
Credit subscriptions, Connect payouts, and local testing.
Stripe Integration
Stripe integration is fully optional. When STRIPE_SECRET_KEY is not set, all credit checks are bypassed and payout logic is skipped.
Credit subscriptions
Senders subscribe to a tier via Stripe Checkout. When an invoice is paid, a webhook credits their account.
| Tier | Price | Credits/month |
|---|---|---|
| Starter | $10/mo | 50 |
| Pro | $25/mo | 150 |
| Team | $75/mo | 500 |
Flow
- Sender calls
POST /api/stripe/checkoutwith{ "tier": "starter" } - Server creates a Stripe Checkout session and returns the URL
- User completes payment on Stripe's hosted page
- Stripe sends a
checkout.session.completedevent linking the customer - On the first
invoice.paidevent, credits are added to the user's balance
Credits are deducted when creating jobs. The research skill costs 2 credits per job.
Connect payouts
Receivers earn money when their submitted work is verified.
Onboarding
- Receiver calls
POST /api/stripe/connect - Server creates a Stripe Connect Express account and returns an onboarding URL
- User completes onboarding on Stripe's hosted page
- Status is checked via
GET /api/stripe/connect/status
Payout on verification
When a job is verified and the receiver has an active Connect account:
- Payout amount =
skill.creditCost * $0.50 - The
researchskill costs 2 credits, so the payout is $1.00 - A Stripe Transfer is created from your platform account to the receiver's Connect account
Environment variables
| Variable | Description |
|---|---|
STRIPE_SECRET_KEY | Stripe secret key (test or live) |
STRIPE_WEBHOOK_SECRET | Webhook signing secret (whsec_...) |
STRIPE_PRICE_STARTER | Price ID for Starter tier |
STRIPE_PRICE_PRO | Price ID for Pro tier |
STRIPE_PRICE_TEAM | Price ID for Team tier |
Testing locally
- Create products and prices in the Stripe Dashboard
- Add the Price IDs to your
.env - Install the Stripe CLI and forward webhooks:
stripe listen --forward-to localhost:3000/api/stripe/webhook- Copy the webhook signing secret (
whsec_...) toSTRIPE_WEBHOOK_SECRETin.env - Use Stripe's test card numbers for checkout