API
Stripe Endpoints
Checkout, webhook, and Connect API endpoints.
Stripe API
All Stripe endpoints return 503 if Stripe is not configured (i.e. STRIPE_SECRET_KEY is not set).
Create checkout session
POST /api/stripe/checkoutCreates a Stripe Checkout session for a subscription tier.
Request body:
{
"tier": "starter"
}Valid tiers: starter, pro, team.
Response (200):
{
"url": "https://checkout.stripe.com/..."
}Redirect the user to the returned URL to complete payment.
Webhook
POST /api/stripe/webhookReceives Stripe webhook events. Requires a valid stripe-signature header.
Handled events:
| Event | Action |
|---|---|
checkout.session.completed | Links Stripe customer to user |
invoice.paid | Credits the user based on subscription tier |
customer.subscription.deleted | Logged (no action currently) |
Connect onboarding
POST /api/stripe/connectCreates or retrieves a Stripe Connect Express account for the authenticated user and returns an onboarding link.
Response (200):
{
"url": "https://connect.stripe.com/..."
}Connect status
GET /api/stripe/connect/statusChecks the current Stripe Connect onboarding status for the authenticated user. Syncs the status to the database if it has changed.
Response (200):
{
"status": "active"
}Possible values: not_connected, pending, active.