Conditionally show & hide price plans in the Stripe customer portal

Shai Schechter • 2023

I love Stripe. I especially love its Checkout and customer portal features. They look great, they’re well tested and conversion optimised, and they save so much time vs building my own subscription management logic and UI.

The problem: I switched Smart Subscriber to have tiered pricing based on number of email subscribers, instead of the same flat rate for everyone. I still wanted to use the customer portal to let customers switch between monthly and yearly. But I didn’t want customers to be able to see and switch to tiers that didn’t match their subscriber count! And whatever plans you pick in the Stripe dashboard are visible in everyone’s customer portal.

The solution: you can now create multiple customer portal “Configurations” in Stripe—not through the dashboard, but through the API. When you send a customer to their customer portal you specify which configuration to use. It controls the headline they see, as well as what they can do (cancel subscription, change plan, etc), and crucially which plans they can choose from.

So all I needed to do was make one Configuration per price tier, containing just the monthly and yearly versions of that tier. (I chose to do this manually as a one-off and add the IDs to my app, but you could also have the app query for the right Configuration at runtime, create it if it doesn’t exist, and cache the ID.) Then send the customer to the right configuration for their subscriber count. 👌