#sspl-paymentintent-errors
1 messages · Page 1 of 1 (latest)
hello
The error indicates that the PaymentMethod was not attached to a customer before, or was detached since then
you are trying to use a PaymentMethod id pm_123 that was never attached successfully
if the original charge fails the PaymentMethod isn't attached
Thanks @crude canopy for responding to my question. Just to confirm my understanding, so if the payment intent was successful, the payment method would have been attached to the consumer as a result of setting "setup_future_usage"="off_session" , right? Those requests failed because the previous payment intents failed and thus the attachment didn't happen?
yes
the goal is to avoid attaching a card that failed
otherwise every attempt would attach bad card over and over
What should I do to prevent the error from happening again?
I was under the impression that "setup_future_usage"="off_session" would always ensure the payment method is attached to the consumer specified in my payment intent
For example, if a payment intent failed but the given payment method was valid, the attachment didn't happen. Subsequently when I make another payment intent with the same payment method it would have failed with the error The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment... which is something I am trying to prevent
If the payment fail we consider the PaymentMethod invalid, we'll never attach it
so you need to understand that behaviour and adapt to it. You can not re-use a card that failed, you have to treat it as a failure and not store its PaymentMethod id, it can never be re-used
Thanks for clarifying. However, a payment intent could fail for different reasons other than invalid payment method. Does Stripe examine the error/decline reason or does Stripe always deem the PaymentMethod invalid?
always invalid
Interesting. For our use case we would want to be able to retry payment (create a new payment intent) with the same payment method on a different day. For example a customer might not have enough credit today but they pay down their credit card bill on the next day.
Is there a way to explicitly attach the payment method to the consumer? Or must I create a new payment method?
We mostly discourage this. You're clearly displaying an error toyour customer that it didn't work, they are unlikely to be okay with you just retrying days later without their approval
I see. For the record we do obtain their approval for charging them on a later date.