#heymato

1 messages · Page 1 of 1 (latest)

lime beaconBOT
old gull
#

Hi there, can you explain the problem in details?

lost sluice
#

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

old gull
#

OK, the status in your DB is not updated because the webhook event has not arrived?

lost sluice
#

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

old gull
lost sluice
#

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

old gull
#

What URL parameters are you talking about?

lost sluice
#

when you are redirected, the redirect_url has some query parameters like, payment_intentid, payment_intent_client_secret and a status.

old gull
#

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.

lost sluice
#

You are correct

#

Do you know where I can find class based documentation of Stripe/useStripe?

old gull