stripe-android
stripe-android copied to clipboard
[BUG] Setup intent not attaching a payment menthod.
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
Another one: seti_1LTXZLE3DVYz6xayHbiQMr3S
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.
Hi Bruno, I'm preparing a demo code to send to you. Until the end of the day I'll send here a repository
You can reproduce the error using the app: https://github.com/alvesleonardo/stripe_bug
Thank you, I'll check it out and try to reproduce.
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?
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
Hi @alvesleonardo, any updates on your end?
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?
Hey @canercanbaz, thanks for reporting that! I can reproduce and have fixed the issue. The fix will be included in our next release.
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.
It will be released next week. Right, I missed that. Will fix.
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.