#krutarth

1 messages · Page 1 of 1 (latest)

minor glacierBOT
woeful arch
#

hi! not sure what you mean by "the context API" exactly

ember peak
#

useContext hook

#

I have stored data using context which i can access using useContext hook

#

similar to redux, used to manage the state values

woeful arch
#

let me think about it but I don't think useContext will help here really since it's a redirect to a brand new page

#

generally you'd use cookies to persist some information on the browser to access after the redirect, or you can pass things like ?my_value=foo in the return_url and access it later

wheat burrow
#

Hi! I'm taking over my colleague. Please, give me a moment to catch up.

#

What kind of data would you like to persist? Depending on this it might make more sense to go with some other solution, e.g. store the data in the PaymentIntent metadata.

ember peak
#

It is simple array of object

wheat burrow
#

I mean, what does this data mean? Is it related to the payment, or UI, or something else?

ember peak
#

the data is not related to payment, lets say some UI

wheat burrow
#

This way only the payments that require redirection to another page will use the return_url, other payments like card will keep you on the page, so you can continue with your JS/React logic. When you do get redirected, your local state will be lost, so if you want to persist some information it's best to use localStorage.

ember peak
#

Okay, so here when I use redirection, is there any way I can know that payment has been successful? So basically if the payment is successful i need to call a dispatch action otherwise not

wheat burrow
#

By "dispatch action" you mean like Redux?

ember peak
#

yes

wheat burrow
wheat burrow
#

Please, let me know if you have any other questions.

ember peak
#

Thanks, For now, I'm good. thanks.