Skip to main content

Stripe Billing Integration

LaunchMyStore uses Stripe to process app payments. This guide covers setting up Stripe, handling subscriptions, and managing the billing lifecycle.

Prerequisites

  1. A Stripe account
  2. Your app registered in the LaunchMyStore developer portal
  3. Stripe API keys (test and live)

Setup

1. Connect Stripe Account

In the developer portal, connect your Stripe account:
  1. Go to Apps > Your App > Billing
  2. Click Connect Stripe Account
  3. Complete the Stripe Connect onboarding
  4. 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

Never expose your Stripe secret key in client-side code. All Stripe API calls should be made from your backend.

Webhook Verification

Always verify webhook signatures:

Idempotency

Use idempotency keys for critical operations:

Best Practices

Handle active, past_due, canceled, unpaid, trialing, and incomplete states appropriately.
Email customers before trial ends, when payment fails, and before cancellation takes effect.
Use Stripe’s Smart Retries and send custom reminder emails for failed payments.
Use Stripe’s Customer Portal for payment method updates and invoice history.
Log all webhook events and subscription changes for debugging and auditing.
Test subscription creation, upgrades, downgrades, cancellations, and payment failures.

See Also