stripe-android icon indicating copy to clipboard operation
stripe-android copied to clipboard

[BUG] Setup intent not attaching a payment menthod.

Open alvesleonardo opened this issue 1 year ago • 11 comments

Summary

When the user don't change the selected card in FlowController payment sheet the FlowController.confirm() function don't attach the selected payment method to the current SetupIntent.

Steps:

  • Create a setup intent
  • Start the flow controller with a customer set up (using clientId and ephemeralKey), this user should have cards saved to use.
  • Open the paymentOptions dialog. .getPaymentOption()
  • Select the preselected option opened.
  • Confirm the setup intent.
  • The setup intent will not have any payment method attatched.

If you change the payment to another card, or select the first item after changing the first one the setup intent will receive a payment method.

Code to reproduce

class CheckoutActivity : AppCompatActivity() { private lateinit var flowController: PaymentSheet.FlowController

override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState)

flowController = PaymentSheet.FlowController.create(
  this,
  ::onPaymentOption,
  ::onPaymentSheetResult
)

} }

flowController.configure( paymentIntentClientSecret = paymentIntentClientSecret, configuration = PaymentSheet.Configuration( merchantDisplayName = "Example, Inc.", customer = PaymentSheet.CustomerConfiguration( id = customerId, ephemeralKeySecret = ephemeralKeySecret ) ) ) { isReady, error -> if (isReady) { flowController.getPaymentOption() } else { } }

Android version

13

Impacted devices

Any

Installation method

gradle

Dependency Versions

kotlin: 1.7.0 stripe-android: 20.8.0 Android Gradle Plugin: Gradle: 7.3.3

SDK classes

PaymentSheet.FlowController

Video

Showing clicking over the same payment and the request fails payment.webm

If the user dismiss the selection modal also fails stripe_payment_selected_2.webm

If the user select another card and goes back to the first one, the transaction is accepted. stripe_payment_selection_3.webm

Other information

In the test enviroment this setup Intent have this problem of no payment method attached after the confirmation returs success.

seti_1LTWbqE3DVYz6xayh13V3oz1 Screen Shot 2022-08-05 at 17 14 06 Another one: seti_1LTXZLE3DVYz6xayHbiQMr3S

alvesleonardo avatar Aug 05 '22 20:08 alvesleonardo

Hi @alvesleonardo, thanks for raising the issue! I checked the Setup Intents you shared, and there wasn't any attempt to confirm them, so it looks like something in your logic is resulting in confirm() not being called. Can you share more of your code? The part you shared looks correct. A minimum working Activity that I can use to try to reproduce would be very helpful.

brnunes-stripe avatar Aug 12 '22 19:08 brnunes-stripe

Hi Bruno, I'm preparing a demo code to send to you. Until the end of the day I'll send here a repository

alvesleonardo avatar Aug 15 '22 13:08 alvesleonardo

You can reproduce the error using the app: https://github.com/alvesleonardo/stripe_bug

alvesleonardo avatar Aug 15 '22 18:08 alvesleonardo

Thank you, I'll check it out and try to reproduce.

brnunes-stripe avatar Aug 17 '22 22:08 brnunes-stripe

Hi @alvesleonardo, I made a small change to your sample code to fetch the keys from the server, so that we can launch the app multiple times and it'll try to confirm a new Setup Intent (otherwise we'll return an error when you try to confirm a Setup Intent that was already confirmed). Here are the changes: https://github.com/alvesleonardo/stripe_bug/pull/1/files On that app, I can confirm the Setup Intent using the default card, whether I dismiss the sheet by clicking outside of it or click on the already selected card. See this video: https://user-images.githubusercontent.com/77990083/185724277-424a04f4-0599-4108-a592-32f9ee525c2a.mp4 So I still cannot reproduce what you're seeing. Can you reproduce the issue by running the code I shared? If so, what device and Android version are you using?

brnunes-stripe avatar Aug 20 '22 01:08 brnunes-stripe

If you want to use your Stripe account to see the Setup Intent status in your dashboard, just remix (on the top right) this glitch project and add your test secret key, publishable key, and a customer id: https://glitch.com/edit/#!/mango-outgoing-chamomile

brnunes-stripe avatar Aug 20 '22 01:08 brnunes-stripe

Hi @alvesleonardo, any updates on your end?

tillh-stripe avatar Sep 14 '22 16:09 tillh-stripe

Hi @brnunes-stripe @tillh-stripe, I didn't want to create a separate issue since my problem is similar to this one. When I delete the default payment method and then press the "Set up" button, it just throws an error. See the screenshot below. I checked the dashboard, and the setup intent was confirmed by the deleted payment method (4444) and failed because it was detached. It should have been (4242). Do you have any idea about this?

image

image

image

image

canercanbaz avatar Sep 21 '22 10:09 canercanbaz

Hey @canercanbaz, thanks for reporting that! I can reproduce and have fixed the issue. The fix will be included in our next release.

brnunes-stripe avatar Sep 22 '22 01:09 brnunes-stripe

Hey @brnunes-stripe, thanks for your quick response! When would it be released? Do you have any ETA for it?

Is it also possible to disable the "Set up" button when all of the cards are deleted? That error is also shown if the button is pressed when no cards are available in that case.

canercanbaz avatar Sep 22 '22 09:09 canercanbaz

It will be released next week. Right, I missed that. Will fix.

brnunes-stripe avatar Sep 23 '22 03:09 brnunes-stripe

The issue is fixed on the latest release, v20.14.0. I'll close this ticket. If you find any issues please open a new one to let us know.

brnunes-stripe avatar Sep 27 '22 00:09 brnunes-stripe