#itsqwerty
1 messages · Page 1 of 1 (latest)
not in a native way no, it charges for the PaymentIntent that you configure it with and whatever amount you've set on that PaymentIntent
How would one use it for subscriptions when having their own custom solution using the PaymentElemnt?
https://stripe.com/docs/billing/subscriptions/coupons
Or there is just no way to achieve this
easiest option is to use Checkout!
but then no, you'd do the coupon stuff before using the PaymentElement
like you'd have a page for "pick your plan" with maybe an "enter a coupon" field, you pass all that info to the backend, on the backend you create the Subscription and can pass in discounts, and then you pass the invoice.latest_invoice to the frontend to use with the PaymentElement(the PaymentIntent will be the discounted one from the Sub/' first Invoice) on the next page in the sign up flow
Right I see
Ty for the help - I will investigate further! If you have any links that might be useful, I would really appreciate it !
well have you already built this flow? https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
Yeah correct however the paymentElement is used before creating the clientSecret
oh, you're using the deferred integration
doesn't really change anything though, there's still nothing native. You could add your own HTML inputs on the page for things like coupon codes, surrounding the PaymentElement, and when the Pay button is pressed, you submit what is in those inputs along with anything else, and use that information on the backend when calling the Subscriptions API and passing discounts to it, and as above, generate and return the client_secret.
So when creating the subscription in the BE - if I provide the discount code the user entered in the FE, it would handle the rest and apply the discounts correctly? And when the FE receives the subscriptionID and clientSecret from the BE after submitting payment and before confirming the payment in the FE, is it possible to show the user the actual price after the discount code was applied?
if I provide the discount code the user entered in the FE, it would handle the rest and apply the discounts correctly?
well for example you can collect a promo code from a user
look it up using https://stripe.com/docs/api/promotion_codes/list#list_promotion_code-code
and then if you found one, pass it to
https://stripe.com/docs/api/subscriptions/create#create_subscription-promotion_code
or you can build your own logic for figuring out what coupon to use and pass https://stripe.com/docs/api/subscriptions/create#create_subscription-coupon, there's a few ways to do this