#johan
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
how are you fulfilling the order?
are you using https://stripe.com/docs/webhooks
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
you're calling the API from your front end?
yes! exactly. we use this https://stripe.com/docs/js/payment_intents/confirm_card_payment to confirm the payment in the front end
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?
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
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
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?
you should create PaymentIntents with idempotency keys https://stripe.com/docs/api/idempotent_requests
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so unless they really go and refresh the page after they already paid this would never happen
is this SCA compliant? we migrated all our payment flows to paymentIntent API for european regulations
I never saw that API before
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
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
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
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
this is because we create one for requests that don't have one
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?
if you pass one we don't create one