1

I have an application that uses Stripe Checkout. When the user clicks on the "buy" button on the "product" page, a value is stored in VueX which indicates which product was selected, then a request is sent to the backend that redirects to stripe checkout. Upon completion, the user is redirected to the "Success" page. In the "Success" page, I need to access the value of that variable from the VueX store, but since the page was redirected to another domain, my application loses its state that was set on the "product" page.

Initially, I tried to do this without vueX and only used local storage, which didn't work either, since the data was lost after the redirect since the subdomain changed after the redirect, but it seems that the same thing is happening with VueX as well.

The only solution I could think of was to save the entire vueX store to localStorage but I am unsure if this will work. How can I make this variable persist even after a redirect to a different domain and then to a new sub-domain?

Ren
  • 171
  • 15
  • If your concern is across subdomains, then check out this feed: https://stackoverflow.com/questions/4026479/use-localstorage-across-subdomains – Justin Levine Jul 29 '20 at 19:52

1 Answers1

0

You could do a redirect with parameters and store them in the subdomain's vuex store, you can read how to do this in this question:

Vue, is there a way to pass data between routes without URL params?

Milos Grujic
  • 544
  • 6
  • 15