#patidarkishor777

1 messages · Page 1 of 1 (latest)

mossy canyonBOT
rugged quest
#

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

earnest elbow
#

I am not using a payment intent

#

We are using a card token

rugged quest
#

the logic is the same

#

although i'd recommend migrating to PaymentMethods and PaymentIntents which is what our latest APIs uses

earnest elbow
#

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

rugged quest
#

ah, okay, sorry, i think i misunderstood the original question

earnest elbow
#

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

rugged quest
#

you can always add the coupon to the subscription?

#

if there's an error / failure then you would know that it wouldn't work

earnest elbow
#

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*

rugged quest
#

how complex are your coupons e.g. are you limiting it to once per customer, or to certain products etc?

earnest elbow
#

It can be based on product, customer and number of usage

rugged quest
#

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

earnest elbow
#

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?

rugged quest
#

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

earnest elbow
#

Like we want customer to enter the card info afetr the coupon is validated

#

That will reduce the actions from the customer

rugged quest
#

you can preview creating a subscription for that customer with the coupon

earnest elbow
#

let m check

rugged quest
#

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

earnest elbow
#

Yes

#

Create a subscription upfront is also not matching out checkout flow.

#

Maybe we need a custom flow to built