Stripe.js charges user multiple times

When a user clicks “Pay Now” it starts the “charge user” workflow. However, in the case a customer accidentally clicks the “Pay Now” button twice in a row (or however many times), the user will get charged that amount of times! Has anyone else experienced this? Anyone know how to make the Pay Now button unclickable while payment is being processed and become clickable again in the case there was an error in the payment card inputs? Thanks so much. @copilot

Hey @ceciliabythesea63,

You should take advantage of States to control elements when conditions are true, such as an Is Processing? boolean state and a matching condition in the call-to-action to make it unclickable when the state is truthy. :slight_smile:

I really appreciate your response! What would be the correct way to set the state if there’s an error with the payment? I tried already the boolean states with “processing” but when a user enters invalid payment info, the “processing” state doesn’t go away because payment was never successfully submitted.

Also, why is it that the plug ins errors don’t pop up if an invalid payment is entered? Months ago I recall popups saying “error… etc”
Now nothing happens.

Since tokenization is a JavaScript function, the only errors you’ll receive will come through a Workflow event. JavaScript errors are not the same as API errors; they’re handled by the plugin and Bubble respectively. The errors you’re recalling are likely those linked to issues occurring with an invalid or returned API call, which is still the case unless you’ve created additional handling.

1 Like