Tanmoy Sarker
Tanmoy Sarker

Reputation: 1266

Tracking payment status in react native webview

I have a React Native app where i'm using sandbox rest api to complete paypal payment with the help of react-native-webview. This is successfully redirecting me to paypal checkout page and doing the payment. But i need to take user to the previous screen of app after successfull payment. I need to know if the transaction is successfull or not. Can i do that with websocket? If so, how can i do that?

Upvotes: 3

Views: 2016

Answers (2)

shekhar singh
shekhar singh

Reputation: 11

 onNavigationStateChange={(navState) => {
          console.log("navState.url ", navState)

          if (navState.url === "your success url") {
            // navigation.navigate('Home');
           

          } else if (navState.url === 'your cancel url') {
            // navigation.goBack();
          }

        }}

Upvotes: 1

Preston PHX
Preston PHX

Reputation: 30442

You can use a deeplink to get back to the app. But as far as being notified, if the transaction is completing without a capture API call from you, then a webhook to your public web server (yes it must be a server, not native app) will work best for a guaranteed notification, since the return is not guaranteed.

Upvotes: 0

Related Questions