Stop entry creation if Payment declined or fails

By: Raymond Arroyo | Asked: 05/25/2024
ForumsCategory: General questionsStop entry creation if Payment declined or fails
Raymond Arroyo asked 3 weeks ago
I'm having an issue with a form that when a user submits the form but there payment declines they still receive a confirmation email and an entry gets created, and then they keep trying to submit it duplicate entries are created and subsequent emails are sent to them. This is causing a lot of confusion. I would like to not create an entry until the payment is captured as successful. and/or if the payment is declined delete the entry or mark a field in it as VOID. I'm using Stripe as our payment processor. And can't seem to find a way to prevent this behavior.
1 Answers
Rob LeVineRob LeVine answered 3 weeks ago
The system has to create an entry, otherwise there's not way to track it. For what you want, I suggest changing the form's email action to have its "Trigger this action when" set to "Successful Payment" and you can even set a separate one up for "Failed Payment". You can also use the After Payment section of the Stripe action to set the value of a hidden status field so you can filter out declined or unpaid entries in your views. As for deleting an entry that is declined I suggest looking at the Additional Customizations section of the Stripe addon documentation.
Raymond Arroyo replied 3 weeks ago

Thanks, that seems to work with the email notification. The other problem I'm now having is if the payment is declined all the fields in the repeater field are getting cleared out, which is breaking my calculation because I have a hidden counter field in the repeater to count the number of repeated entries. Any idea on how to prevent this behavior?

Raymond Arroyo replied 3 weeks ago

Actually I just figured that out, I removed the summary field I had, and now its working as expected.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community