Documentation Index
Fetch the complete documentation index at: https://docs.auction-rise.com/llms.txt
Use this file to discover all available pages before exploring further.
Billing
The template includes a Stripe integration for subscription billing. It is disabled by default — enable it insaas.config.ts and add your Stripe environment variables to activate.
Enabling Billing
Insaas.config.ts, set billing.enabled to true and add your plans:
priceId must match a recurring price ID from your Stripe dashboard.
Checkout Flow
CallcreateCheckoutSession(planId) from a server action or API route to redirect users to Stripe-hosted checkout:
/settings/billing?success=true. On cancellation, to /settings/billing?canceled=true.
Customer Portal
Let existing subscribers manage their subscription (cancel, change plan, update payment method) via the Stripe Customer Portal:Webhook Handler
Stripe webhook events are handled atPOST /api/billing/webhook. The handler in lib/billing/webhooks.ts verifies the signature and processes these events:
| Event | Default behavior |
|---|---|
checkout.session.completed | Log + TODO: upsert subscription record |
customer.subscription.updated | Log + TODO: update subscription status |
customer.subscription.deleted | Log + TODO: mark subscription canceled |
invoice.payment_failed | Log + TODO: notify user |
handleWebhookEvent() in lib/billing/webhooks.ts to write subscription state to your database.
Registering the Webhook in Stripe
In the Stripe dashboard, add a webhook endpoint pointing tohttps://your-domain.com/api/billing/webhook and subscribe to at minimum:
checkout.session.completedcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_failed
STRIPE_WEBHOOK_SECRET.
Environment Variables
| Variable | Required | Description |
|---|---|---|
STRIPE_SECRET_KEY | Yes | Stripe secret key (sk_live_... or sk_test_...) |
STRIPE_WEBHOOK_SECRET | Yes | Webhook endpoint signing secret (whsec_...) |
NEXT_PUBLIC_APP_URL | Yes | Base URL for Stripe redirect URLs |