Javascript 如何在付款后将用户重定向回应用程序?
流程如下所示:Javascript 如何在付款后将用户重定向回应用程序?,javascript,node.js,react-native,Javascript,Node.js,React Native,流程如下所示: 1. User taps on "Pay Now" in the app. 2. An in-app WebView will be opened up and user will be required to make the payment in a third-party payment page. 3. After payment, user will be redirected to another link. 我们如何在付款后将用户带回应用程序?我们应该使用Dee
1. User taps on "Pay Now" in the app.
2. An in-app WebView will be opened up and user will be required to make the payment in a third-party payment page.
3. After payment, user will be redirected to another link.
我们如何在付款后将用户带回应用程序?我们应该使用Deeplink还是URL更改侦听器
我们使用React-Native作为前端,Nodejs作为后端。我以前已经实现了这个简单的解决方案。使用web视图,我正在检查url以了解是否已完成:
checkUrlState = (url) => {
if (url.includes('specific/part/of/your/url')) {
// code to hide WebView
}
}
<WebView
...yourOtherProps
onNavigationStateChange={state => this.checkUrlState(state.url)}
/>
checkUrlState=(url)=>{
if(url.includes('specific/part/of/your/url')){
//隐藏WebView的代码
}
}
this.checkUrlState(state.url)}
/>
简单而有效