Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCA Webview behaving strangely/restarts app after close #1654

Closed
bramski opened this issue Oct 3, 2019 · 34 comments
Closed

SCA Webview behaving strangely/restarts app after close #1654

bramski opened this issue Oct 3, 2019 · 34 comments
Assignees
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@bramski
Copy link

bramski commented Oct 3, 2019

Summary

See Video: https://cl.ly/6115ddc0378b
After inputting a credit card number requiring SCA, you are unable to click on "Complete Authentication" the video shows someone tapping "FAIL AUTHENTICATION" when they are actually attempting to tap on "Complete Authentication".
The application is then restarted after the tap (splash page is shown instead of the payment screen).

Code to reproduce

This is using tipsi-stripe beta.8, which uses stripe-android 10.4.5
SCA is initiated with:

 paymentService.authenticatePaymentIntent({ clientSecret: paymentIntentClientSecret })
        .then(onPaymentAuthenticated)
        .catch((error) => {
          displayToast(getPaymentAuthenticationErrorMessage(error));
          onPaymentAuthenticationFailed(error);
        });

Android version

Screenshot_20191003-103502_Settings

Impacted devices

Galaxy S8+ SM-G955W

Installation method

Linked in via tipsi-stripe.

implementation project(':tipsi-stripe')

SDK version

10.4.5

Other information

ADB Logcat output during problems:
https://gist.github.com/bramski/1e0c0daf74bcfa0b8e7f4bf211effa96

@mshafrir-stripe mshafrir-stripe self-assigned this Oct 7, 2019
@mshafrir-stripe mshafrir-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Oct 7, 2019
@mshafrir-stripe
Copy link
Collaborator

@bramski thanks for filing. Can you verify if this is happening on a specific Android API version, or across all API versions?. What is the exact stacktrace you're seeing?

@bramski
Copy link
Author

bramski commented Oct 7, 2019

@mshafrir-stripe Appears to be just the version and device listed though we just put it into the wild so we may see some reports from our customers.

@bramski
Copy link
Author

bramski commented Oct 7, 2019

Stacktrace... did you have a look at the logcat I posted? looks like at 11:28:45.044 the app restarts but I don't see a specific stack trace. it only appears that the window manager destroys our app and remounts it but I have no idea why.

@mshafrir-stripe
Copy link
Collaborator

mshafrir-stripe commented Oct 11, 2019

@bramski I believe I discovered the cause of the crash. I can issue a 10.x release early next week.

@bramski
Copy link
Author

bramski commented Oct 13, 2019

Fabulous! Keep me informed. I'll have to make some PRs and app updates to propagate it.

@mshafrir-stripe
Copy link
Collaborator

@bramski can you try 10.4.6 and confirm if it fixes the issue?

bramski added a commit to bramski/tipsi-stripe that referenced this issue Oct 15, 2019
@bramski
Copy link
Author

bramski commented Oct 15, 2019

@mshafrir-stripe Sorry did not fix the issue.

@mshafrir-stripe
Copy link
Collaborator

@bramski thanks for checking. I'll need to add some log statements and have you run through the use case again to narrow down where the crash is happening. I'll let you know when I have something available.

@mshafrir-stripe
Copy link
Collaborator

mshafrir-stripe commented Oct 15, 2019

Can you use the instructions below to integrate with the commit that adds logging?

https://jitpack.io/#stripe/stripe-android/webview-logs-SNAPSHOT

Then run the following from the command line to see logs.

$ adb logcat -s StripeSdk

@bramski
Copy link
Author

bramski commented Oct 15, 2019

Sure. @mshafrir-stripe that commit is in the snapshot or you need me to do something additional to use that commit?

@mshafrir-stripe
Copy link
Collaborator

@bramski integrating with that Jitpack snapshot dependency is enough, nothing else to do

@mshafrir-stripe
Copy link
Collaborator

@bramski were you able to run through the repro steps with logging enabled?

@bramski
Copy link
Author

bramski commented Oct 16, 2019

@mshafrir-stripe
https://gist.github.com/bramski/a4e211cd8014ba71e534111214c2e4df

I'm acting as middleman here, it's our tester and she is not co-located with me so I don't have the device thus its a bit of a long round-trip to repro. Hope this is what you need.

@bramski
Copy link
Author

bramski commented Oct 16, 2019

Suggest we re-open the ticket for now.

@mshafrir-stripe
Copy link
Collaborator

@bramski looks like the call to finish the web view activity finished, so I'll need to add more logs to debug what's happening

@mshafrir-stripe
Copy link
Collaborator

@bramski can you try

	        implementation 'com.github.stripe:stripe-android:0dfee80c85'

bramski added a commit to bramski/tipsi-stripe that referenced this issue Oct 21, 2019
@andychen1111
Copy link

Hi @mshafrir-stripe, I am bramski's co-worker. Here is the new log.

@mshafrir-stripe
Copy link
Collaborator

@andychen1111 this is using commit 0dfee80c85?

Looks like there's a crash when activity.finish() is called. Can you verify if onActivityResult() is called from the launching activity in your app?

@mshafrir-stripe
Copy link
Collaborator

@andychen1111 @bramski please reopen if you still need assistance

@bramski
Copy link
Author

bramski commented Oct 29, 2019

Hey @mshafrir-stripe please reopen. Got back from vacation yesterday. let's keep working on this!

@bramski
Copy link
Author

bramski commented Oct 29, 2019

This is using that commit yes. Not sure about onActivityResult() as we're using tipsi-stripe and only have interaction from javascript land.

@mshafrir-stripe
Copy link
Collaborator

@bramski can you set a breakpoint in tipsi? From the Stripe SDK's perspective, the SDK Activity has finished and the result is being returned to the app Activity that launched it.

@mshafrir-stripe
Copy link
Collaborator

@bramski @andychen1111 please reopen if you're able to get more details from the tipsi side

@bramski
Copy link
Author

bramski commented Nov 12, 2019

Please leave this open. We are still actively working on this.

@bramski
Copy link
Author

bramski commented Nov 14, 2019

hey @mshafrir-stripe we've stepped through the code. The promise to return the result to our javascript handler gets called and then the app crashes. The window itself is still behaving incorrectly, button presses on the window seem to press both buttons.

@mshafrir-stripe
Copy link
Collaborator

@bramski is there any code you can share? What's the last line of code you reach before the crash happens?

@bramski
Copy link
Author

bramski commented Nov 14, 2019

@bramski
Copy link
Author

bramski commented Nov 14, 2019

That promise comes from here: https://github.com/bramski/tipsi-stripe/blob/experimental-stripe-android-fix/android/src/main/java/com/gettipsi/stripe/StripeModule.java#L368
and that's the interface to javascript. So it appears that webview is closing on crash or something and that's causing the react-native activity to restart. I'm pretty unfamiliar with how react-native handles returning that asynchronous data to our app but nothing looks wrong with the way thats being done.

@mshafrir-stripe
Copy link
Collaborator

@bramski is there any code called after the promise is resolved? Is there a way to set a breakpoint in the Tipsi code?

@bramski
Copy link
Author

bramski commented Nov 15, 2019

@mshafrir-stripe that's exactly what we did. We stepped through the java code on the tipsi side. It appears something is crashing in teardown of the webview activity such that it's restarting the activity running the react native app.

@mshafrir-stripe
Copy link
Collaborator

@bramski did you confirm if you only saw crashes on Android 9?

@andychen1111
Copy link

Hi @mshafrir-stripe, I only have a physical device with Android 9 (Samsung Galaxy S8+), which has the bug. I also tested it again on emulators with Android 7.1.1, 8.1, and 9.0. They did not crash after processing the payment.

@mshafrir-stripe
Copy link
Collaborator

@bramski @andychen1111 has there been any progress on your end?

james-interest pushed a commit to james-interest/tipsi-stripe that referenced this issue May 1, 2020
acmeyer added a commit to livelyhood/tipsi-stripe that referenced this issue Jun 12, 2020
* Stripe AppInfo added with stripe-android, react-native & android upgrade

AppInfo is needed so that Stripe can identify the transactions that are created through tipsi-stripe

Along with this, the compile and target SDK versions for android have been bumped to v28, stripe-android has been upgraded to 9.3.5, the minSdkVersion has increased to v19 (required).

Example app changes:
- Android compile and target SDK change from 26 -> 28
- Android min SDK change from 16 -> 19
- Android multiDexEnabled true
- Android support libraries upgraded to v28
- React native upgraded to 0.59.10
- React upgraded to 16.8.6
- android.useDeprecatedNdk=true was removed since it is no longer supported.
- android.enableAapt2=false was removed since it is now the default
- Gradle build tools upgraded to 3.4.1.  Gradle wrapper upgraded to v5.5.

* Adding .circleci

* Stripe AppInfo and library upgrades

- CircleCI config (for android)
- Android - Compile SDK version increased from 26 to 28
- Android - Target SDK version increased from 26 to 28
- Android - Min SDK version increased from 16 to 19
- Android - stripe-android increased from 8.1.0 to 9.3.5
- Android - Added Stripe AppInfo to requests

Example app:
- Updated react-native to 0.59.10 from 0.45.0
- Updated react to 16.8.6 from 16.0.x
- Upgraded gradle

Tests:
- Updated test suite to use webdriver 5.x from 4.7.1
- Update appium to 1.14

* stripe-ios AppInfo initial config

* `managedAccountCurrency` is no longer relevant according to the migration guide.

* typo-fixes

* Update Stripe CardForm options to support the "name"-only option in the requiredBillingAddressFields-option

* Dynamically list supported ApplePay networks on this device & write documentation

* Switch eslint-config & allow rules that are already existing patterns in the codebase

* Add missing docs pages, and reorganize the sidebars a little bit

* Add prettier to format the rendered-docs-html making diffing easier, and render the current docs

* Upgrade Example Project to Stripe 16 & Cocoapods changed something

* misc test fix

* React-Native 59 for the Example App for iOS

* ApplePay example tweaks now that it's running

* Got the testapp changes working!

* Prettier Javascript Formatting

* Extract Deprecated Methods to a separate file

* Adds Android confirmPayment, authenticatePayment, createPaymentMethod

Note: This commit breaks iOS - a subsequent commit is needed
Added confirmPayment, authenticatePayment, createPaymentMethod bindings for src/Stripe.js
Upgrade to stripe-android:10.1.1

* Adds Android confirmSetupIntent and authenticateSetup

 Note: This commit breaks iOS - a subsequent commit is needed

* Android changes for confirming a payment intent, with test page

- Confirmation of a payment intent resolves with { status, paymentIntentId }
- status is one of 'CANCELED', 'FAILED', 'SUCCEEDED', 'TIMEDOUT', or 'UNKNOWN'
- test page requires 'STRIPE_BACKEND' env to be defined, and it should contain a URL with a trailing slash pointing to a deployment of https://github.com/mindlapse/example-tipsi-stripe-backend

* Android changes for confirming a payment intent, with test page (cont..)

Wiring in the new example app PaymentIntentScreen

* Prettier configs in subfolders

* Prettier Formatting

* Adds SetupIntentScreen and stripe-android:10.2.1 (contains setupintent fix)

* PaymentIntent demo page updated to include manual entry with the card widget

* Add some jsDocs

* TPSCardField fixes

* iOS: Stub-in new methods, tweak certain bits of lifecycle

* API changes

- Dropped support for 'returnURL' for now (until there is demand for it to be introduced along with proper demo/tests)
- Added experimental Promise handling for authenticateSetup and authenticatePayment
- Allow a payment intent to be confirmed with just the clientSecret (without requiring a payment method to be provided client side)

* iOS: Implement Serializers / Parsers for marshalling parameters/results across the RN Bridge + JSDoc

* JSDoc: Missed a type

* iOS: error case robustness

* iOS: implement authenticatePaymentIntent / authenticateSetupIntent

* Prettier Formatting for PaymentIntent/SetupIntent Test Screens

* Tweak confirmPayment/confirmSetup to check & process 3DSecure Actions

* React 16.9 componentWillMount deleted compatibility

* Get Travis to install Xcode10.3 & Node >= 8.3

* oraclejdk8 is not supported on Travis's Xenial boxes

* Apply suggestions from code review

PRFeedback!

* Update npm to try to fix error

* Fix field focus infinite recursion in keyboardWillShow on > RN 45

Fixes tipsi#408

React-Native removed support for the react(Will|Did)MakeFirstResponder APIs in this commit: facebook/react-native@bc1ea54#diff-3e154f92c7ba4cb47e96785b9dadf3aa

* Fix incorrect test js syntax

* Fixup some issues with ci for ios

* Prettier formatting

* Adds test cards to demo page

Test cards can be found here:

https://stripe.com/docs/testing

* Adding manual confirmation support for Payment Intents

* Merge fixes, updated npm run configure to list rewrite envs

* Doc update - adds Objects > PaymentMethod

* Have new setup & payment intent methods return the status off of the intent itself

* example app: PaymentIntentScreen updates

* Added an extra test card (has no 3ds & always declines)

* Example app: automatic flow error handling update

* Additional test cards

* AddCardDialogFragment changes to support PaymentMethods

* Remove support for sourceId from confirmPayment

* tipsi-stripe iOS Native SDK version to 16.0.6

adrien.teulade-pod-point / timrc discussed this in Discord

* Remove Signatures that React-Native can't resolve at runtime

these are typedefs that revert to NSStrings at runtime, but that means that the name doesn't exist which then fails to pass their check here: https://github.com/facebook/react-native/blob/c20070f10458d48d6ac1eaac49e681e932bfb9fd/React/Base/RCTParserUtils.m#L119

* Example: Prettier (JS Formatting)

* Tighten up some types as per discussion

Discussion Thread: https://github.com/tipsi/tipsi-stripe/pull/515/files#r310823098

* Android: Ensure useStripeSDK is always set to true

* Adds returnURL to confirm calls and 'Intent' suffix to the Stripe.js interface

* Token fix

* Missed prettier-jsx formatting

* Robustness in CardParams parsing from tokens

* jsdoc cardparam.token

* iOS: API Naming Consistency

* iOS: Enable recommended modern iOS Warnings

* Fixup reasonable lint exceptions in the example app

* eslint-based fixes

* Example-app: API Naming Consistency with Native

* PaymentIntent requires_payment_method -> requires_paymentMethod based on iOS

* iOS, JS: fixup IntentStatus values to match Server Docs

* Disabling authenticateSetupIntent until we need it

* PaymentIntent guide - doc update

* Small fix to example app

* Roll 8.0.0-beta.1

* lint & prettier changes

* iOS Fixup `paymentRequestWithCardForm` for stripe-ios Breaking API Changes

* Add metadata support on Android

* Fix JSDocs around PaymentMethod customerId

* JSDoc the PaymentMethodCard Type -- especially Brand

* Misc consistency

* iOS: Don't assert if the paymentMethod is not provided in this helper (reused when a paymentMethodId might be provided)

* iOS: Use the official way to bridge CardBrands to Strings

* Android: Attempt to convert CardBrands instead of exposing the lowercased constant values

* Restored brand slugs for PaymentMethod card serialization

* Change CardBrand handling to expose API differences in Stripe Constant-values

* Card-based APIs expose brand as a Human Presentable Value -- eg "American Express"
* Newer, PaymentMethod:Card-based APIs expose brand as a brand-slug Identifier -- eg "amex"

* Add display utilities around card brands

* JSDoc the PaymentCardTextField Component

* Doc update, re: PaymentIntent API

* Roll 8.0.0-beta.2

* Fix iOS constant-key macro

* stripe-ios 16.0.7

* Removed support for token creation in stripe.paymentRequestWithCardForm

Only PaymentMethod creation is supported

* Removed support for token creation in stripe.paymentRequestWithCardForm

* PaymentCardTextField component, event bubbling issue

* Further Improve JSDocs

* Roll out 8.0.0-beta.3

* Updated changelog & appinfo

* iOS Stripe-AppInfo version to 8.x

* provide a status of unknown in the error state of serializing (Payment/Setup)IntentResults

This matches iOS

* iOS Changelog tweaks

* Make our post-link-ios script suggest stripe-ios 16.x

* Serialize `paymentMethodId` when resolving confirmSetupIntent/authenticateSetupIntent

Related feature request for Android PaymentIntents: stripe/stripe-android#1445

* stripe-android 10.4.0 & paymentMethodId consistency!

* Upgraded stripe-android to 10.4.0 and added paymentMethodId

* nil/null robustness (in case users pass null for this parameter)

* Parse & use the returnURL if provided for relevant APIs

* Quick-Document the returnURL property

* Better Connect Stripe Error Messages through to React-Native

* Roll out 8.0.0-beta.4

* Enable android pay in example app

* Docs: add saving card documentation

* Docs: build new version

* Finish up fixing the PaymentCardTextField Component iOS Lockup

Moots tipsi#508 tipsi#521

* iOS: Support using multiple Stripe accounts with 3DSecure

* Updated confirmSetupIntent error codes

* iOS: Android Error Consistency re: authenticationFailed

* Example app screen improvements

* Expose setStripeAccount to JS (Enable Stripe Connect accounts)

* Fix incorrect method access. Add usage and code to example app

* Roll out 8.0.0-beta.5

* iOS: Fix happy path for cards

* Roll out 8.0.0-beta.6

* iOS: Remove assert forcing paymentMethod/id to be passed to confirmPaymentIntent

Instead of forcing them to re-submit the same paymentMethod/paymentMethodId at the time of confirmPaymentIntent, the user can instead attach the paymentMethod/id on the backend before calling confirm

* Example app - added missing lines

* Fix for <STRIPE_ACCOUNT>

* Revert "Fix for <STRIPE_ACCOUNT>"

This reverts commit 7e61f1a.

* Revert 1a5a5cc

* Revert ee98528

* PropTypes: Allow omitting paymentMethod/paymentMethodId on confirmPaymentIntent

Fixes: tipsi#536

* iOS: Misc readability

* iOS: Treat `requires_capture` as a successful confirmPaymentIntent status

* Move the PaymentIntentStatusRequiresCapture check to the confirmPaymentIntent method

* confirmPaymentIntent: clean up wrong enum copy-paste error

* iOS: Default to useStripeSDK = true

* iOS: Clean up some unnecessary redundant returnURL parsing

* To align with iOS, the confirmPaymentIntent promise is rejected unless the payment intent ends up in `succeeded` or `requires_capture`

* If the resultingStatus of the PaymentIntent is either `succeeded`, or `requires_capture` then resolve the promise with `{ status: 'succeeded', ... }`
* If the resultingStatus of the PaymentIntent is either `canceled`, `requires_action`, or `requires_confirmation`, then consider the payment intent to be `cancelled` and reject the promise.
* Otherwise, consider the payment intent to be `failed` and reject the promise

* Roll out 8.0.0-beta.7

* Upgrade to latest stripe-android on the 10.4 branch

* Allow/Suggest stripe-ios @ 17.0.1 or later

* Android: Allow RequiresConfirmation to be a successful outcome

* Logic cleanup

* Roll out 8.0.0-beta.8

* Switch Statement Robustness -- stripe-ios 17.0.2 compatibility

* Prettier Formatting

* Add setStripeAccount support.

Adds Stripe Connect Support.
new JS method `setStripeAccount` which can be an account id or null.

* Migration doc

* Upgrade tipsi-android to 1.4.6

See: stripe/stripe-android#1654

* Roll 8.0.0-beta.9

* Fix extracting billingDetails

* Fixed compilation error for 8.0.0.beta9 due to fpx issue

* Mark an unsupported entry with a comment

* Fix build on xcode 11.4

See stripe/stripe-ios#1526

* Update npmignore

* Update for AndroidX (#2)

* Saving before trying android studio migrate

* AndroidX conversion tweaks

* AndroidX conversion tweaks

Co-authored-by: Tomas Maly <tmaly1980@gmail.com>

Co-authored-by: Dave MacDonald <mindlapse@gmail.com>
Co-authored-by: Frederic Barthelemy <git@fbartho.com>
Co-authored-by: Kirill Pinchuk <cybergrind@gmail.com>
Co-authored-by: Dave MacDonald <mindlapse@users.noreply.github.com>
Co-authored-by: André Perdigão <andrepcg@gmail.com>
Co-authored-by: Bram Whillock <bramski@gmail.com>
Co-authored-by: Igor Kozlovsky <igor.lemon.kozlovsky@gmail.com>
Co-authored-by: Max Hung <info@maxhung.co.nz>
Co-authored-by: Torres Yang <yangguanhua@gmail.com>
Co-authored-by: Tomas Maly <tmaly1980@gmail.com>
@mshafrir-stripe
Copy link
Collaborator

@bramski FYI the official Stripe client library for React Native is now in public beta.

https://github.com/stripe/stripe-react-native

renabriseno68 added a commit to renabriseno68/android-flutter-tipsi-stripe that referenced this issue Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

3 participants