question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

createSourceWithParams - threeDSecure Android Source not fires

See original GitHub issue

Before I have submitted the issue

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

The problem

I would like to use createSourceWithParams with “threeDSecure” type, and on iOS works fine, but on android when I am returning to the app from browser, there is no promise fires, and have no Source object.

Environment

  • tipsi-stripe version: 7.4.0
  • iOS or Android: Android
  • React-Native version: 0.56.0

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

  • android.compileSdkVersion: 26
  • android.buildToolsVersion: 26.0.3
  • android.defaultConfig.minSdkVersion: 16
  • android.defaultConfig.targetSdkVersion: 26

Code To Reproduce Issue (Good To Have)

pay = async (mutation, deal) => {
    let paymentRequest;
    try {
      paymentRequest = await stripe.paymentRequestWithCardForm({
        ...options,
        createCardSource: true
      });
      const threeDSecure = Platform.OS === "android"
        ? paymentRequest.card.three_d_secure
        : paymentRequest.details.three_d_secure;
      if (threeDSecure === "recommended" || threeDSecure === "required") {
        let prefix = Platform.OS === "android"
          ? `my-app://my-app/stripe-redirect`
          : `my-app://stripe-redirect`;
        let secure3dSourceResponse = null;
        try {
          const { dealFeeUSD } = this.state;
          secure3dSourceResponse = await stripe.createSourceWithParams({
            type: "threeDSecure",
            amount: dealFeeUSD || 3000,
            currency: "USD",
            flow: "redirect",
            returnURL: prefix,
            card: paymentRequest.sourceId
          });
         //  iOS works fine at this point
          // When returning from stripe page, the promise should fires here!!!
          console.log('secure3dSourceResponse', secure3dSourceResponse)
        } catch (error) {
          console.log('secure3dSourceResponse', secure3dSourceResponse);
        }
      } else {
        if (paymentRequest && paymentRequest.tokenId) {
          this.handlePayDeal(mutation, deal, paymentRequest.tokenId);
        }
      }
    } catch (error) {
      console.log(`Error is: ${error}`);
    }
  };

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

5reactions
lukebrandonfarrellcommented, Jul 16, 2019

@fabicsp solved it this morning. You need to use a second scheme on Android if you are already using custom schemes (e.g. deeplinks), for example my.custom.scheme.tipsi, and use the full class name on the activity com.gettipsi.stripe.RedirectUriReceiver. Here is our working code:

<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="my.custom.scheme.tipsi" tools:replace="android:scheme" />
        </intent-filter>
  </activity>

Then in JS we are using com.redu.ashleigh.tipsi://stripe-redirect as the return URL.

0reactions
scaralfredcommented, Oct 1, 2020

@lukebrandonfarrell Thanks for you answers. Your library is great, it does not support third party payement though (like Alipay in my case). I understand you no longer have access to the cose, but if you remember (in terms of UX) the answer at question number 1, that would be super useful… but if you dont remember it I would understand too. Thanks for your help anyway 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Card authentication and 3D Secure | Stripe Documentation
Although cardholders can't dispute payments that have been successfully authenticated using 3DS as fraudulent with an upfront financial chargeback, issuers ...
Read more >
ThreeDSecure - Documentation - Braintree Open Source
Instances of this class have a method for launching a 3D Secure authentication flow. If you use the Braintree SDK from within an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found