User GuidePayment
Stripe Configuration
Configure Stripe payment
Stripe is the preferred payment solution for international markets, supporting credit cards, Apple Pay, Google Pay, and more.
Setup Steps
- Visit Stripe Dashboard
- Register and activate your account
- Get API keys
Environment Variables
STRIPE_SECRET_KEY="sk_live_xxx"
STRIPE_PUBLISHABLE_KEY="pk_live_xxx"
STRIPE_WEBHOOK_SECRET="whsec_xxx"
STRIPE_SUCCESS_URL="https://yourdomain.com/payment-success"
STRIPE_CANCEL_URL="https://yourdomain.com/payment-cancel"Test Keys
Use test keys in development:
STRIPE_SECRET_KEY="sk_test_xxx"
STRIPE_PUBLISHABLE_KEY="pk_test_xxx"Webhook Configuration
Set up Webhook in Stripe Dashboard:
- Developers → Webhooks → Add endpoint
- Endpoint URL:
https://yourdomain.com/api/payment/stripe/webhook - Select events to listen to
Events to Listen
checkout.session.completedinvoice.paidcustomer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deleted
Configure Pricing
Subscription Mode
export const paymentConfig = {
mode: 'subscription',
subscriptionPlans: [
{
id: 'basic-monthly',
name: 'Basic Monthly',
price: 9.99,
interval: 'month',
stripePriceId: 'price_xxx',
features: ['Feature 1', 'Feature 2'],
}
]
}One-time Payment
export const paymentConfig = {
mode: 'one-time',
oneTimePlans: [
{
id: 'starter',
name: 'Starter',
price: 99,
stripePriceId: 'price_xxx',
features: ['Lifetime access'],
}
]
}