• Resolved melcriddle

    (@melcriddle)


    Hello there,
    I’m wondering if it’s possible for the Forminator plugin to provide support for idempotency?
    Sometimes if a user refreshes the browser (because the form seems to be taking a very long time to process), or if the user accidentally clicks the submit button twice, two stripe payments will be processed at the exact same time.

    Stripe API supports idempotency for safely retrying requests without accidentally performing the same operation twice. Is it possible that you can integrate this functionality in the Forminator Form, so that we aren’t having to refund customers for duplicate payments please? Or if it is already in place, could you please help us to avoid duplicate form submissions and payments from taking place. You can see in the submission log that duplicate submissions have been occurring for us.

    Thank you.

    • This topic was modified 4 years, 10 months ago by melcriddle.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @melcriddle

    I hope you are doing well.

    I checked the plugin code and I do see the idempotency_key:

    private static $OPTIONS_KEYS = ['api_key', 'idempotency_key', 'stripe_account', 'stripe_version', 'api_base'];

    I’ve pinged our developers to confirm if we implemented it on our integration.

    We will update once hearing back from the developers.
    Best Regards
    Patrick Freitas

    Thread Starter melcriddle

    (@melcriddle)

    Thanks Patrick for your prompt reply.
    Look forward to hearing from you.
    Mel.

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello there @melcriddle

    We got some feedback from the Forminator developers, who will proceed with some code fixes in the upcoming releases so we prevent any double charges. I really cannot provide any ETA on this release, so keep an eye for any updates and the relevant changelog. 🙂

    Thank you,
    Dimitris

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello there @melcriddle

    Our Second Level Support devs were able to provide a custom snippet that should make the forms avoiding such issues.

    <?php
    add_action( 'wp_footer', function(){
    	?>
    	<style>
    		.wpmudev-fm-submitting{
    			position: relative;
    			cursor: wait;
    		}
    		.wpmudev-fm-submitting:after{
    			content: "";
    			position: absolute;
    			left:0;
    			right: 0;
    			bottom:0;
    			top:0;
    		}
    	</style>
    	<script>
    		(function($){
    			$(function(){
    				let _submit_buttons = $('.forminator-button-submit');
    				if( _submit_buttons.length ){
    					let _parent_button = null;
    					_submit_buttons.on('click', function(){
    						_parent_button = $(this).parent();
    						_parent_button.addClass('wpmudev-fm-submitting');
    						setTimeout(function(){
    							if( _parent_button ){
    								_parent_button.removeClass('wpmudev-fm-submitting');
    								_parent_button = null;
    							}
    						}, 3000);
    					});
    					$('body').on('after:forminator:form:submit', function(){
    						if( _parent_button ){
    							_parent_button.removeClass('wpmudev-fm-submitting');
    							_parent_button = null;
    						}
    					});
    				}
    			});
    		})(window.jQuery)
    	</script>
    	<?php
    }, 21 );

    You can add this snippet code into a new MU plugin.
    If you are not familiar with mu-plugins you can read about them here:
    https://premium.wpmudev.org/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Warm regards,
    Dimitris

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Duplicate Stripe Payments & Form Submissions’ is closed to new replies.