Recommendations for showing subscription plan pricing when a promo code is supplied #449
-
Context: Recently inherited a Ruby on Rails project and it's using Pay for integration with Stripe. They're on v2.2.2 at the moment and we're exploring our upgrade options. In parallel, we're trying to provide them with a quick solution to having promo codes that that not just give a user a discounted rate when they're billed BUT also show them the applied discount rate on subscription plans before they pull their credit card out. Since the app isn't using Stripe's checkout widget, I'm curious if there is an existing pattern for showing plan pricing with a promo code (and/or the associated coupon's % off) without doing the math ourselves (but rather rely on Stripe showing the discounted pricing). Any pointers? It's my first time using this particular gem. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Sup @robbyrussell 👋 You'd just include the promo code in the You'll probably need to add something to keep track of which promo code and the discount that's applied. We're not currently saving any of those details. |
Beta Was this translation helpful? Give feedback.
Sup @robbyrussell 👋
You'd just include the promo code in the
subscribe
call. The additional options get passed over to the Stripe API. See: https://github.com/pay-rails/pay/blob/v2.2.2/lib/pay/stripe/billable.rb#L56You'll probably need to add something to keep track of which promo code and the discount that's applied. We're not currently saving any of those details.