#chrl.
1 messages · Page 1 of 1 (latest)
Hi there!
Hi!
the discount 50OFF is applied in the dashboard and the checkout session generated will be for 5USD
Can you clarify how you the discount is 'applied in the dashbaord"? Maybe you can share an example subsription ID (sub_xxx)?
Stripe never "knows" about this discount currently. In the call to create a new checkout session the set price is just orignal_price * (1-discount) where discount has the values from 0 to 1 matching 0% to 100%
So there might be 2 subscriptions with the same product (name) but different prices right now.
Goal would be to have it on the same product with the same price but the price stays the same on the subscriptions with custom discounts
In the call to create a new checkout session the set price is just orignal_price * (1-discount) where discount has the values from 0 to 1 matching 0% to 100%
Got it, so this has nothing to do with the Stripe dashboard, correct? You jsut create a Checkout Session with the API for the correct amount directly?
At this moment, yes
Due to a change in how we would like to handle things I would like to pass over the discount to stripe so it can be calculated on the checkout so I can historically see what discount was used for the plan.
Right, so you need to use thediscountproperty of the Checkout Session: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-discounts
Now I would want to do this historically as well which would mean: Update all subscriptions with PlanA to the base price X and depending on what they are currently paying apply a discount of y% to the subscription so it stays the same price.
In this case yes you can update the price of your existing subscriptions, which is explained here: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
Another option, instead of directly updating the price, would be to simply addmetadatato the subscription to track this.
Thanks, Ill play around with the subscription updates with a combination of price and coupon updates and see how well that works.
The metadata solution is one I had in mind as well but I am trying to get everything to the same "version" for now to not have too many differences in the end
Make sense. Make sure to test this in test mode first, and you could use Test Clock for this: https://stripe.com/docs/billing/testing/test-clocks
Will do for sure, thanks :)!