【问题标题】:How to redirect user back to the app after payment?付款后如何将用户重定向回应用程序?
【发布时间】:2018-12-06 06:39:29
【问题描述】:

流程如下:

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 Change Listener ?

  1. 对于 Deeplink,即使是应用内 web 视图,是否也会提示用户弹出窗口?这不是我们想要的理想行为。

我们希望在第 3 步之后顺利过渡回应用程序(适用于 iOS 和 Android)。

我们使用 React Native 作为前端,Nodejs 作为后端。

【问题讨论】:

    标签: javascript node.js react-native


    【解决方案1】:

    我之前已经实现了这个简单的解决方案。使用 web 视图,我正在检查 url 以了解我是否完成了:

    checkUrlState = (url) => {
        if (url.includes('specific/part/of/your/url')) {
          // code to hide WebView
        } 
    }
    
    <WebView
      ...yourOtherProps
      onNavigationStateChange={state => this.checkUrlState(state.url)}
    />
    

    【讨论】:

    • 简单而有效
    猜你喜欢
    • 2018-01-07
    • 1970-01-01
    • 2015-03-03
    • 2013-07-13
    • 2016-11-16
    • 2020-05-19
    • 2013-05-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多