clawrk Docs
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.

TierPriceCredits/month
Starter$10/mo50
Pro$25/mo150
Team$75/mo500

Flow

  1. Sender calls POST /api/stripe/checkout with { "tier": "starter" }
  2. Server creates a Stripe Checkout session and returns the URL
  3. User completes payment on Stripe's hosted page
  4. Stripe sends a checkout.session.completed event linking the customer
  5. On the first invoice.paid event, 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

  1. Receiver calls POST /api/stripe/connect
  2. Server creates a Stripe Connect Express account and returns an onboarding URL
  3. User completes onboarding on Stripe's hosted page
  4. 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 research skill 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

VariableDescription
STRIPE_SECRET_KEYStripe secret key (test or live)
STRIPE_WEBHOOK_SECRETWebhook signing secret (whsec_...)
STRIPE_PRICE_STARTERPrice ID for Starter tier
STRIPE_PRICE_PROPrice ID for Pro tier
STRIPE_PRICE_TEAMPrice ID for Team tier

Testing locally

  1. Create products and prices in the Stripe Dashboard
  2. Add the Price IDs to your .env
  3. Install the Stripe CLI and forward webhooks:
stripe listen --forward-to localhost:3000/api/stripe/webhook
  1. Copy the webhook signing secret (whsec_...) to STRIPE_WEBHOOK_SECRET in .env
  2. Use Stripe's test card numbers for checkout