I am working on a Stripe project and there are basically two things I need to achieve and failed to find in the documentation how so far:
Our app needs to allow applying promotion codes (coupons) to already existing Subscriptions, I need to
- check whether given promotion code is applicable for the given subscription before actually updating the subscription (some promo codes may be limited to "first-time order only", or limited by minimum order value)
- show/preview the discounted price the user would get if they applied this coupon
The user sees their subscription, they can input promo code & try to apply it, get the discounted price they would get with this promo code and THEN they can choose to submit/update the subscription.
Is it possible to do something like this with Stripe API?
I have tried:
- manually retrieving the promo codes and check their
.activeproperty, but that doesn't take into account specific restrictions like first-time order or minimum order value - with creating new subscriptions through Checkout Session it's easy, I can try to retrieve the session URL and if the promo code cannot be applied, I receive and handle the error, but the problem is with updating already existing subscriptions, it would be nice if there were some equivalent of the "try to get checkout session with applied coupon" option
- I could try my best to guess if the promo code would be applicable by retrieving all the information about the promo code (
.restrictionsprop) and the subscription and manually compare everything and then manually calculate how the price would look like, but it looks over-complicated, prone to errors and I would be much more confident if I could just input the subscription and the promo code, tried to "pre-apply" it and Stripe told me OK/not OK
Any ideas? Is there any "try to apply coupon"/"check if applicable"/"preview discount" feature?
I have the feeling I can hardly be the first one with this required functionality, and everyone can't solve it just by applying the promo code "blindly", right?