Build · Payments · intermediate
Add a Stripe Customer Billing Portal
Payments SaaS intermediate LovableCursor
How to use
- Copy the prompt below
- Paste it into Lovable, Cursor
- Review the output and follow up with refinements
Prompt
Add a "Manage Billing" button to the /account/settings page that opens the Stripe Customer Portal. When clicked, call a serverless function that uses the user's stripe_customer_id from the database to create a Stripe Billing Portal Session, then redirect the user to the returned portal URL. The portal should allow users to upgrade their plan, downgrade, update payment method, and cancel their subscription. Set up a Stripe webhook handler at POST /api/webhooks/stripe to listen for customer.subscription.updated and customer.subscription.deleted events. When these fire, update the user's subscription_tier, subscription_status, and subscription_end_date in the database accordingly. On the settings page, display the current plan name (e.g., "Pro"), its status (Active / Canceled), and the renewal or expiry date. Related prompts
Was this helpful?
Enjoying this guide?
Get weekly practical guides, plus tool updates and implementation playbooks.