Checkout page attaches Payment Method to customer even if card data is incorrect.
ukito-pl opened this issue · comments
Bug report
Describe the bug
Checkout page in 'subscription' mode saves payment methods even when payment is not sucessfull (declined card for example).
This may not be a bug in a strict sense but it is a major inconvience, because if user enters wrong card data by mistake it will be later seen in his payment methods without any indication that it is wrong card.
After inspecting events generated by stripe I can see that there is no setup_intent.*
events present in logs. So it seems like Checkout in subscription
mode doesn't use SetupIntent API to create payment methods as is recommended in docs (https://stripe.com/docs/api/payment_methods/attach). When I used SetupIntent API to manually add a payment method to a customer it is not created if card data is incorrect, which is desirable behaviour.
I understand that it may be a design decision to make it work that way, but it is unituitive from customer's view point.
To Reproduce
- Create customer
- Create Checkout Session in
subscription
mode with addedcustomer
field andpayment_method_types
set to['card']
- Go to Checkout page
- Enter wrong card data ( for example 4000000000000002 from test cards list: https://stripe.com/docs/testing#cards-responses)
- Enter correct card (for example 4242424242424242 from test cards list)
- Go to dashboard or customer portal to see that coresponding customer has failed payment method attached to his account.
Expected behavior
I expected that Checkout page wouldn't add payment methods to customer if first subscription payment has failed.