#heymato
1 messages · Page 1 of 1 (latest)
Hi there, can you explain the problem in details?
Hello Jack. Of course
When a payment is created I also add a record in my firestore database. Whenever a webhook of stripe is triggered I update this status of stipe into that record. The problem that I have now, is when I am redirected after a succesfull payment to the redirect url, my database status is not yet 'paid', but 'created' or 'requires action', ... .
since my success page shows different feedback to the customer, depending on that status, I now show the wrong screen/content
OK, the status in your DB is not updated because the webhook event has not arrived?
well the event fires, but since the webhook contains some wait (async) functions, the front-end is faster then the back-end
I think it is a matter of milliseconds but ofcourse that will vary
Got it. You can also call stripe.retrievePaymentIntent() (https://stripe.com/docs/js/payment_intents/retrieve_payment_intent) in your webpage to retrieve the paymentIntent status, and use the status to determine what content to show
Oh OK, great!
I'll check that
Is it safe to rely on the url parameters? I am really new to stripe/react/... and I see that the code you sent me is for function based components. Since I am working on a class based website, I don't know how to work with the useStripe hook
What URL parameters are you talking about?
when you are redirected, the redirect_url has some query parameters like, payment_intentid, payment_intent_client_secret and a status.
I see, no you shouldn't rely on the URL query params. Anyone can modify the params (e.g., change status to paid) and your system would think the payment is successful.
You are correct
Do you know where I can find class based documentation of Stripe/useStripe?