#johan

1 messages ยท Page 1 of 1 (latest)

split swiftBOT
blissful breach
#

๐Ÿ‘‹ happy to help

#

how are you fulfilling the order?

proud bluff
#

we have another API to create a new document (gym class) in our DB and attach this document in the user that made the purchase

#

no, we don't use webhooks to handle paymentIntents in our end

blissful breach
#

you're calling the API from your front end?

proud bluff
blissful breach
#

no I mean after the payment is confirmed how are you calling the API to create the record in your db? is it from your front-end?

proud bluff
#

ah okay my bad, yes! from our front end like this:

#

where handleVerificationSuccess triggers an API call to the server and assigns the class to the customer

#

this works say 99% of time times but sometimes it doesn't assign the class or even we have other cases where the customer gets charged twice and assigns the class once

blissful breach
#

ok let's say your customer closes their browser tab before you get to this step of the code then your API wouldn't be called

#

this is why you should use instead the webhooks to handle fulfilling the order

proud bluff
#

okay I understand, and why do you think there are cases sometimes where they get charged multiple times?

#

because say we start fulfilling order using webhooks, what does it guarantee that they won't get charged twice?

blissful breach
#

so unless they really go and refresh the page after they already paid this would never happen

proud bluff
#

is this SCA compliant? we migrated all our payment flows to paymentIntent API for european regulations

#

I never saw that API before

blissful breach
#

Idempotency is not related to payments

#

it's a key to let us know that you have already submitted a request with the same key before so we don't process it twice

proud bluff
#

perfect thank you! also, we're using an API version from 2018. could this be one of the reasons as well? should we use the latest paymentIntent API version?

#

2018-08-23

blissful breach
#

it's always good to upgrade to the latest Stripe API version

#

but I don't think in your case it has anything to do with that

proud bluff
#

to be honest I don't think the idepotency keys would help much. they're are already being created in the request. I just check the event request in stripe dahboard and the idepotency key is coming up there for each paymentIntent request

blissful breach
#

this is because we create one for requests that don't have one

proud bluff
#

okay thanks for explaining, I still don't understand why I need to create one then if you guys are creating them. wouldn't be redundant?

blissful breach
#

if you pass one we don't create one