Nuda Kit uses Stripe for payment processing. This guide walks you through setting up Stripe for both development and production.
Stripe integration includes:
Checkout Sessions
Customer Portal
Webhooks
Subscriptions
sk_test_ for test mode)Add the key to your backend/.env file:
STRIPE_SECRET_KEY=sk_test_your_secret_key_here
| Variable | Description | Example |
|---|---|---|
STRIPE_SECRET_KEY | Your Stripe secret key | sk_test_xxx or sk_live_xxx |
STRIPE_WEBHOOK_SECRET | Webhook signing secret | whsec_xxx |
STRIPE_API_VERSION | Stripe API version | 2025-10-29.clover |
STRIPE_DEVICE_NAME | Device name for Stripe CLI | localhost |
STRIPE_EVENTS_WHITELIST | Webhook events to handle | See below |
STRIPE_EVENTS_WHITELIST=checkout.session.completed,invoice.paid,invoice.payment_failed,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted
Webhooks notify your app when payment events occur (e.g., successful checkout, subscription canceled).
Nuda Kit includes a Stripe CLI Docker container that automatically forwards webhooks to your backend. No manual installation required!
1. Start Docker Services
docker compose up -d
2. Get the Webhook Secret
View the Stripe container logs to find your webhook signing secret:
docker compose logs stripe
Look for a line like:
> Ready! Your webhook signing secret is whsec_xxxxx
3. Add to Environment
Copy the secret and add it to your backend/.env:
STRIPE_WEBHOOK_SECRET=whsec_xxxxx
.env if you restart Docker.https://your-api-domain.com/webhooks/stripe
checkout.session.completedinvoice.paidinvoice.payment_failedcustomer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deleted| Event | When It Fires | Handler |
|---|---|---|
checkout.session.completed | Payment successful | Creates subscription |
invoice.paid | Invoice payment received | Updates subscription |
invoice.payment_failed | Payment failed | Handle failure |
customer.subscription.created | New subscription | Sync subscription |
customer.subscription.updated | Subscription changed | Update status |
customer.subscription.deleted | Subscription canceled | Mark as canceled |
| Mode | Key Prefix | Use Case |
|---|---|---|
| Test | sk_test_ | Development & testing |
| Live | sk_live_ | Production payments |
Toggle between Test and Live mode in the Stripe Dashboard (top-right corner). Each mode has separate:
Use these card numbers in Test mode:
| Card Number | Description |
|---|---|
4242 4242 4242 4242 | Successful payment |
4000 0000 0000 3220 | 3D Secure authentication |
4000 0000 0000 9995 | Payment declined |
4000 0000 0000 0341 | Card error |
Use any future expiration date and any 3-digit CVC.
STRIPE_SECRET_KEY to .envdocker compose up -d)STRIPE_WEBHOOK_SECRET to .env| Issue | Solution |
|---|---|
| "STRIPE_SECRET_KEY is not set" | Add key to .env file |
| "Webhook signature verification failed" | Check STRIPE_WEBHOOK_SECRET matches container logs |
| Webhooks not received locally | Ensure Stripe CLI container is running (docker compose ps) |
| Webhook secret changed | Get new secret from docker compose logs stripe |
| Subscription not created | Verify webhook events are firing |