com.drastikbydesign.stripe
com.drastikbydesign.stripe copied to clipboard
Error: You cannot use a Stripe token more than once
The error "You cannot use a Stripe token more than once" seems to happen sometimes. It could occur when the user is redirected to the initial contribution page/step for some reason (e.g. their card was declined or didn't have sufficient funds), When the user proceeds to complete the donation once more, they could get the "You cannot use a Stripe token more than once" error.
To me this suggests that when the user is redirected to the initial contribution page/step, sometimes there is no new Stripe token generated. And in those cases the error will occur. If this is correct, then we have to figure out why in some cases the Stripe extension does not generate a new token. Possibly a javascript issue of some sort.
Has anyone else detected this issue happening?
At one point, code was added to preserve the token, and not generate if it exists. This is because sending of the token to Stripe should not occur until final submission of the contribution.
@drastik Thanks for the info. Yes, it makes sense that the sending of the token shouldn't occur until final submission of the contribution. But if the user is returned back to the initial contribution step, why not generate a new token? Then the new token can be sent upon the final submission of the contribution.
@BorislavZlatanov can you replicate this with one of the Stripe test cards? That would be really helpful.
It sounds more like the user hit the back button instead of being redirected.
To answer the question as to why @BorislavZlatanov, at the time I wrote it, if you went back, the CC details area was hidden and a button added to "Edit CC Details" - after you press the button, the token is discarded, they can enter new CC details, and a new token would be generated at that time.
I'm honestly uncertain if this is still the case because there has been so much activity in this repo and I have been otherwise occupied.
@h-c-c @drastik I haven't been able to replicate it so far, unfortunately. But I could verify that it has happened when there was a redirect to the initial donation step due to a card declined error.
I triggered a declined card error artificially using the appropriate Stripe test card details, but didn't get the "You cannot use a Stripe token more than once" error after that.