react native Linking listen for a specific URL and back to the app?

Viewed 228

I'm gonna implement a payment situation and for that I use Linking. according to the documentation I tried to open the gateway like this:

Linking.openURL(`my URl to payment GATEWAY`); //forget about URL its perfectly fine and working

after that browser redirect user to a page which has an specific URL and says that payment is successful, and I need to listen for that URL and after redirecting I need to close the browser and show a success message in the app. I tried to listen to an event on linking like below:

const returnFunc = (url) => {
      console.log(url)
    }

    Linking.addEventListener('url', returnFunc)

but this listener never fires whatsoever, how can I solve the problem? any help would be appreciated.

0 Answers
Related