This payment method was previously used — Stripe Exception
Very recently I encountered the error:
“This payment method was previously used without being attached to a customer stripe”
to a certain extent it’s self explanatory although it took me a few hours searching + a brief session with a stripe customer support agent to fully understand what the actual problem was.
When I was searching for any information regarding this, there was next to nothing that can be helpful beside a Reddit thread that mentioned something about a similar exception when working with connected accounts.
So there is a form in which through Stripe Elements are collected payment data and depending on the situation a Payment Intent is confirmed and that’s the problem when you use payment_method without attaching it to a customer in the words of the support agent:
…that error means the PaymentMethod ID (e.g., pm_…) you are trying to use is a single-use token that has already been consumed and is now invalid…
Тhe idea is that, you can’t use “stray” payment methods, especially for Payment Intent …
General rule of thumb: If you create payment method you need to attach it to a customer if you want to re use it, if it’s only for a Payment Intent.
When used with a Setup Intent the method can be used afterwards, when you need to gather payment data from a form you need to use Setup Intent
Conclusion
Those kind of exceptions can be deceiving and cost you a lot of time researching, don't hesitated to contact the Stripe Customer Support, they are always eager to help even with problems that are more specific, they will do a research, talk to other team members but ultimately will find an answer for your problem.
Share this post