#patidarkishor777
1 messages · Page 1 of 1 (latest)
hello! If you've built a custom checkout flow, i assume you're using PaymentIntents to collect payment
PaymentIntents do not support Coupons. you would need to implement the logic to perform the calculation and create / update the PaymentIntent to the final amount
the logic is the same
although i'd recommend migrating to PaymentMethods and PaymentIntents which is what our latest APIs uses
Yes but the payment intent flow has some limitations, where customer can dynamically select subscriotion plan and the charged at the same time.
ALso at the same time either they can select a charges or the subscription plan,
And all we need to be without loading a page.
With payment intent we always need to make a call when customer change the charges or the plan
ah, okay, sorry, i think i misunderstood the original question
Sure let me explain
We have a checkout where customer can tick the plans and the charges.
Then customer enter the card info and submit checout
On backend we capture the info and using api we create subscription or the invoice
Now we need to allow customers to enter coupon code
But for this before we process the backend checkout logic we want to validate the coupon
But I did not found an way to validate a coupon / So I need your help here
you can always add the coupon to the subscription?
if there's an error / failure then you would know that it wouldn't work
yes but if the coupon is not valid then it throws a error
But we want to validate token before we create a subscription
validate coupon*
how complex are your coupons e.g. are you limiting it to once per customer, or to certain products etc?
It can be based on product, customer and number of usage
we don't have any API that allows you to "validate" it. You would have to implement your own logic to validate it, which imo, isn't worth the effort
the best way is to change your flow and create the Subscription first, then attempt to apply the coupon
but this way customer won't have a clarity if the coupon is going to apply or not
Can you brief how others are validating coupons on their checkouts?
can you elaborate a bit more on why they wouldn't have clarity?
Then customer enter the card info and submit checout - i assume you are also asking the customer to input the coupon here right?
The way i envision it to work is your frontend would make the request to your backend to create the Subscription with that coupon - if it fails, you can flag that to your customer
Like we want customer to enter the card info afetr the coupon is validated
That will reduce the actions from the customer
hrm, i think you can try this : https://stripe.com/docs/api/invoices/upcoming
you can preview creating a subscription for that customer with the coupon
let m check
btw, my opinion is that you should still attempt to create the subscription first. You don't need the customer's payment method details in order to create the Subscription upfront.
You can create the Subscription with default_incomplete, then use the corresponding PaymentIntent to collect the payment method details from the customer
if you use the upcoming invoice, that's an unnecessary additional step / API call