David Kimura PRO said about 2 years ago on 3D Secure 2 Credit Cards and Stripe Checkout :
  in the subscriptions_controller.rb you can create a method to look up the plan.  Something like

def selected_plan
  plan = Plan.find(params[:plan])

And plan_code would be pro, annual, or whatever else that matches the plan ID within Stripe.

Then in the controller action, you would reference this selected_plan method in place of where 'pro' is in the episode.

Since Stripe has the list of plans, you need to have some awareness of what these plan ids are. Typically they will be fairly static within your application. So, you could set a global variable with an array of the plans. Something like

PLAN = [
  { slug: 'pro', name: 'Pro', price: 1500 },
  { slug: 'student', name: 'Student', price: 900 },

And wherever you need to loop over your available plans, then you can reference this global variable. This does limit you to having to deploy and make code changes for any new plans, but that could be a non-issue.