Payment Gateways
Integrating Payment Gateways
Framecast AI supports four payment gateways out of the box:
You can enable one or all of them depending on your target audience and region.
For local development, use sandbox / test mode credentials for all payment gateways. This lets you test the full payment flow without processing real charges. Switch to live credentials only when you deploy to production.
Stripe
Get Your Stripe Test Keys
Log in to your Stripe Dashboard and make sure you are in Test mode (toggle at the top right). Navigate to the API keys section. You will need your Publishable Key and Secret Key (both will start with pk_test_ and sk_test_).
Set Up Webhook with Stripe CLI
For local development, Stripe cannot reach localhost directly. You need the Stripe CLI to forward webhook events to your local server.
Install the Stripe CLI and log in:
stripe loginThen start forwarding events to your local webhook endpoint:
stripe listen --forward-to localhost:3000/api/payment-gateways/stripe/subscription-webhookThe CLI will print a webhook signing secret that looks like whsec_.... Use that as your STRIPE_WEBHOOK_SECRET.
The webhook handles the following events:
checkout.session.completed— processes credit purchases (primary event)charge.succeeded— acknowledgedpayment_intent.succeeded— acknowledgedpayment_intent.created— acknowledgedcharge.updated— acknowledgedproduct.created— acknowledgedprice.created— acknowledged
Update Your .env File
NEXT_PUBLIC_STRIPE_IS_ENABLED=true
STRIPE_PUBLISHABLE_KEY=pk_test_your-stripe-test-publishable-key
STRIPE_SECRET_KEY=sk_test_your-stripe-test-secret-key
STRIPE_WEBHOOK_SECRET=whsec_your-stripe-cli-webhook-secretPricing packages and credit amounts are fully configurable from the Admin Panel. No need to manually create Stripe products or price IDs.
PayPal
Create a PayPal Sandbox App
Log in to the PayPal Developer Dashboard and select Apps & Credentials. Make sure you are in Sandbox mode. Create a new app to get your Client ID and Client Secret.
Update Your .env File
PAYPAL_API_URL=https://api-m.sandbox.paypal.com
NEXT_PUBLIC_PAYPAL_CLIENT_ID=your-paypal-sandbox-client-id
PAYPAL_CLIENT_SECRET=your-paypal-sandbox-client-secretThe PAYPAL_API_URL must point to the sandbox endpoint for local development. When you go to production, change it to https://api-m.paypal.com.
Razorpay
Get Your Razorpay Test Keys
Log in to your Razorpay Dashboard and make sure Test mode is enabled. Navigate to Account & Settings then API Keys under Website and App Settings. Generate a new key pair.
Update Your .env File
NEXT_PUBLIC_RAZORPAY_KEY_ID=rzp_test_your-razorpay-test-key-id
RAZORPAY_KEY_SECRET=your-razorpay-test-key-secretRazorpay test keys start with rzp_test_. When you go to production, switch to live keys that start with rzp_live_.
Flutterwave
Create a Flutterwave Test Account
Log in to your Flutterwave Dashboard and make sure you are in Test mode (toggle at the top left). Navigate to Settings then API Keys. You will need your Public Key, Secret Key, and Encryption Key.
Update Your .env File
NEXT_PUBLIC_FLUTTERWAVE_PUBLIC_KEY=FLWPUBK_TEST-your-flutterwave-test-public-key
FLUTTERWAVE_SECRET_KEY=FLWSECK_TEST-your-flutterwave-test-secret-key
FLUTTERWAVE_ENCRYPTION_KEY=FLWSECK_TESTyour-encryption-keyFlutterwave test keys start with FLWPUBK_TEST- and FLWSECK_TEST-. When you go to production, switch to live keys that start with FLWPUBK- and FLWSECK-.