tipsi / tipsi-stripe

React Native Stripe binding for iOS/Android platforms
MIT License
1.14k stars 527 forks source link

Redirection after Alipay payment made through createSourceWithParams hangs on hooks.stripe.com #681

Closed scaralfred closed 3 years ago

scaralfred commented 4 years ago

Before I have submitted the issue

[ ] I have read an installation guide
[ ] I know that for an iOS I need to install pods because I've read the installation guide
[ ] I have read a linking guide and checked that everything is OK like in manual linking guide
[ ] I know that before using tipsi-stripe I need to set options for my app as described in usage guide

The problem

We have integrated Alipay payment method via createSourceWithParams. Apparently anything works fine and even the Alipay payment goes through, but when it comes to redirect the user to the app we only see a blank webpage "hooks.stripe.com". There should be an Alipay page with a button to go back to the app. Weird fact is that this happens 90 percent of the times. A very few times this goes through. This was tested with different connection environments... Wifi, phone connection, VPN, etc. We can't get rid of the issue. Here are 2 videos of the cases => https://drive.google.com/drive/folders/1HGG9NYOJ2sDJTdYiXkzudcNqQC_idMaO?usp=sharing

Environment

Links to logs and sources

Create a GIST which is a paste of your full logs or sources, and link them here. If you are reporting a bug, always include build or error logs!

For Android, please provide the following sections from android/app/build.gradle:

Screenshots, GIFs (Must to have)

Just drag-and-drop them to this textarea

Code To Reproduce Issue (Good To Have)

Please remember that with sample code it's easier to reproduce the bug and it's much faster to fix it.

############# AndroidManifest.xml

<activity android:name="com.gettipsi.stripe.RedirectUriReceiver">
        <intent-filter>
         <action android:name="android.intent.action.VIEW" />
         <category android:name="android.intent.category.DEFAULT" />
         <category android:name="android.intent.category.BROWSABLE" />
         <data android:scheme="${tipsiStripeRedirectScheme}" tools:replace="android:scheme" />
      </intent-filter>
</activity>

############# app/build.gradle manifestPlaceholders = [tipsiStripeRedirectScheme: "ecocat"]

############# PaymentScreen.js

const params = { type: 'alipay', amount: price, usage: 'single', currency: subscription.currency.code, returnURL: 'ecocat://alipay' }

  try {
    const source = await stripe.createSourceWithParams(params)
    if (source && source.sourceId) {
      const item = {
        source: source.sourceId,
        subscriptionId: subscription.id
      }
      this.props.stripeRequest(item)
      this.props.profileRequest()
    } else {
      __DEV__ && console.tron.log('NO ALIPAY SOURCE')
      crashlytics().recordError(new Error('NO ALIPAY SOURCE'))
      paymentFailed(subscription)
      this.setState({
        alertVisible: true,
        message: I18n.t('paymentError'),
        loading: false
      })
    }
    this.setState({ loading: false })
  } catch (e) {
    __DEV__ && console.tron.log(e)
    crashlytics().recordError(new Error(e))
    this.setState({
      alertVisible: true,
      message: I18n.t('paymentError'),
      loading: false
    })
  }

Here are 2 videos of the cases => https://drive.google.com/drive/folders/1HGG9NYOJ2sDJTdYiXkzudcNqQC_idMaO?usp=sharing

scaralfred commented 4 years ago

I created a public repository to reproduce the issue. Please check the README file for instructions.

App repository => public repository