Stripe Billing Integration
LaunchMyStore uses Stripe to process app payments. This guide covers setting up Stripe, handling subscriptions, and managing the billing lifecycle.Prerequisites
- A Stripe account
- Your app registered in the LaunchMyStore developer portal
- Stripe API keys (test and live)
Setup
1. Connect Stripe Account
In the developer portal, connect your Stripe account:- Go to Apps > Your App > Billing
- Click Connect Stripe Account
- Complete the Stripe Connect onboarding
- Copy your Stripe webhook signing secret
2. Configure Webhook Endpoint
Set up a webhook endpoint to receive Stripe events:3. Create Products in Stripe
Create products and prices matching your pricing model:Checkout Flow
Create Checkout Session
When a merchant selects a plan, create a checkout session:Handle Checkout Completion
Managing Subscriptions
Get Subscription Status
Upgrade/Downgrade Plan
Cancel Subscription
Reactivate Canceled Subscription
Customer Portal
Let merchants manage their billing through Stripe’s Customer Portal:Handling Webhook Events
Subscription Updates
Payment Failures
Testing
Test Mode
Use Stripe test mode during development:Test Card Numbers
Test Webhook Events
Use Stripe CLI to forward webhooks locally:Security
Webhook Verification
Always verify webhook signatures:Idempotency
Use idempotency keys for critical operations:Best Practices
Handle all subscription states
Handle all subscription states
Handle
active, past_due, canceled, unpaid, trialing, and incomplete states appropriately.Send proactive emails
Send proactive emails
Email customers before trial ends, when payment fails, and before cancellation takes effect.
Offer dunning management
Offer dunning management
Use Stripe’s Smart Retries and send custom reminder emails for failed payments.
Provide self-service
Provide self-service
Use Stripe’s Customer Portal for payment method updates and invoice history.
Log everything
Log everything
Log all webhook events and subscription changes for debugging and auditing.
Test thoroughly
Test thoroughly
Test subscription creation, upgrades, downgrades, cancellations, and payment failures.
See Also
- Pricing Models - Choose your pricing strategy
- Usage-Based Billing - Implement metered billing