Problem/Motivation
I can only make one payment with a webform with a stripe element (Stripe Credit Card). If I remove the element and re-create it I get another go.
I get an error in Chrome's console:
donate?ajax_form=1&_wrapper_format=drupal_ajax:1 Failed to load resource: the server responded with a status of 500 ()
ajax.js?v=9.2.0:513 Uncaught Drupal.AjaxErrormessage: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 500\nDebugging information follows.\nPath: /donate?ajax_form=1\nStatusText: error\nResponseText: The website encountered an unexpected error. Please try again later.Stripe\\Exception\\InvalidRequestException: This PaymentIntent's amount could not be updated because it has a status of succeeded. You may only update the amount of a PaymentIntent with one of the following statuses: requires_payment_method, requires_confirmation, requires_action. in Stripe\\Exception\
So for some reason it is trying to update the same payment intent each time.
Apologies if this should be in the Stripe module queue as I am not sure which module is causing this.
Steps to reproduce
Create a webform with an amount, name, email address and address part elements minimum. Add a Stripe credit card element that refers to these elements in the webform submission.
Validation on the card fields work. One payment can be successfully made.
After that one successful payment, each click of the submit button will generate the above Ajax error. This happens whether the card fields are valid or not.
If you then remove the Stripe element, save the webform definition, re-add the stripe element and save again, you can then make another payment.
Proposed resolution
Make sure code is always doing a new intent.
Remaining tasks
Unknown
User interface changes
No
API changes
No
Data model changes
Unknown