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

Card details not complete Exception on Android #382

Closed
Young-Slim-Jim opened this issue Oct 7, 2021 · 5 comments
Closed

Card details not complete Exception on Android #382

Young-Slim-Jim opened this issue Oct 7, 2021 · 5 comments

Comments

@Young-Slim-Jim
Copy link

Young-Slim-Jim commented Oct 7, 2021

Describe the bug
Stripe.instance.createPaymentMethod() throws a StripeException "Card details not complete" on Android while it not doing so on iOS.

To Reproduce
Steps to reproduce the behavior:

  1. Start App on a Android device
  2. Entering a valid Credit Card and Zip in a CardField Widget
  3. Tapping the confirm button.
  4. Stripe.instance.createPaymentMethod() throws a StripeException "Card details not complete". No ErrorCode etc.

Expected behavior
Function should return a valid PaymentMethod.

Smartphone / tablet

  • Device: Pixel 4 Emulator (but I also tried it on an actual device
  • OS: Android 12
  • Package version: 1.3.0
  • Flutter version 2.2.3

Additional context
The weird thing about this Exception is, that the code I am using is working on iOS devices, only when I try to use a card on an android device it is not working. So im would say this is not about the chosen card / Zip / billing details I am providing to the function. I am aware of the fact that the android app needs special configuration, but I took care of all of that:

  • I am using Theme.AppCombat
  • I am using FlutterFragmentActivity
  • Kotlin version is 1.5.10
  • Android gradle build tools version: 4.1.3
  • Gradle version: gradle-7.0.2-bin.zip
  • Flutter doctor shows that everything is fine.

we also tried using the CardFormField, but it is throwing the same exception.
I also have an controller attached to the CardField, when debugging it shows that right before createPaymentMethod is called, the complete attribute of the controller is set to true and all other attributes are set (except cvc and number, these are set to null, but there are also set to null on iOS, so I think this is normal ?)

When using the CardField Widget, there was one Warning in the logs which was interesting to me:

WARNING! Initial card data value has been ignored.
Handling card data manually will break PCI compliance provided by Stripe. Please make sure you understand the severe consecuences of it. https://stripe.com/docs/security/guide#validating-pci-compliance.
To handle PCI compliance yourself and allow to edit card data programatically,set dangerouslyGetFullCardDetails: true

I can’t really make sense of it since we did not change a already used card, the Stripe user we were using did not have any saved Payment Methods / cards. Also, the CardField was compltely empty from the beginning and the dangerouslyGetFullCardDetails and dangerouslyGetFullCardDetails are both set to false.

You would really help us if you could share any idea on what could be causing this problem.
Thank you.

@jonasbark
Copy link
Member

Can you check if you can reproduce this as well on the example application from this repository?

@klivin

This comment has been minimized.

@klivin

This comment has been minimized.

@jamesblasco

This comment has been minimized.

@Young-Slim-Jim
Copy link
Author

i was able to fix this error.

It was still there after updating the package version to 2.0.0 and updating flutter to 2.5.2
I was using the stripe package in combination with the stacked library for viewModel based state management.
Right before the Stripe.instance.createPaymentMethod() was called, I changed a attribute of the viewModel to show a loading indicator instead of the screen which was holding the CardField. After I moved the loading indicator into a button, and kept displaying the CardField the whole time, it was working as it should.
My guess is that Stripe.instance.createPaymentMethod() couldn't deal with the CardField Widget not being in the widget tree anymore, because it didn't fetch the data from it in time.
It is still puzzling to me why it still worked on iOS though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants