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

confirmPayment not accepting setupFutureUsage when using paymentMethodId (Android) #367

Closed
ghitier opened this issue Jun 23, 2021 · 1 comment · Fixed by #390
Closed
Labels
bug Something isn't working P0 Address these issues first

Comments

@ghitier
Copy link
Collaborator

ghitier commented Jun 23, 2021

Describe the bug
When calling confirmPayment (of the useStripe hook) with both the paymentMethodId and setupFutureUsage options. The setupFutureUsage option has no effect. This issue is Android only.

To Reproduce
Steps to reproduce the behavior:

Call confirmPayment as below:

const { confirmPayment } = useStripe();

const { paymentIntent, error } = await confirmPayment(
        stripe_client_secret,
        { type: 'Card', paymentMethodId: 'pm_somepmid', setupFutureUsage: 'OffSession', },
);

When testing on Android the card will not be saved, on iOS it will.

Expected behavior
The card to be saved to the customer both on Android and iOS

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: OnePlus 5t
  • OS: OxygenOS 10.0.1 (Android 10)
  • Version: 10

Additional context

I have applied this patch to fix the issue, for stripe-react-native version 0.1.4:

diff --git a/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt b/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt
index dcef630..917320c 100644
--- a/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt
+++ b/node_modules/@stripe/stripe-react-native/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt
@@ -105,6 +105,7 @@ class PaymentMethodCreateParamsFactory(private val clientSecret: String, private
         paymentMethodId = paymentMethodId,
         paymentMethodOptions = paymentMethodOptionParams,
         clientSecret = clientSecret,
+        setupFutureUsage = setupFutureUsage,
         returnUrl = mapToReturnURL(urlScheme)
       )
     } else {
@thorsten-stripe thorsten-stripe added bug Something isn't working P0 Address these issues first labels Jun 24, 2021
@thorsten-stripe
Copy link
Contributor

Yes, it's missing https://github.com/stripe/stripe-react-native/blob/master/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt#L104-L109

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 Address these issues first
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants