From 5beab7ef9ceeb5ad313a4f506fc391d1055f61f7 Mon Sep 17 00:00:00 2001 From: dparker1005 Date: Wed, 24 Feb 2021 11:52:17 -0500 Subject: [PATCH] Hide Payment Request button when form submitted --- js/pmpro-stripe.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/pmpro-stripe.js b/js/pmpro-stripe.js index dd4f84c26..ea27908bf 100644 --- a/js/pmpro-stripe.js +++ b/js/pmpro-stripe.js @@ -130,12 +130,22 @@ jQuery( document ).ready( function( $ ) { }); // Handle payment request button confirmation. paymentRequest.on('paymentmethod', function( event ) { + $('#pmpro_btn-submit').attr('disabled', 'disabled'); + $('#pmpro_processing_message').css('visibility', 'visible'); + $('#payment-request-button').hide(); + event.complete('success'); pmpro_stripeResponseHandler( event ); }); } } }); + // Find ALL
tags on your page + jQuery('form').submit(function(){ + // Hide payment request button on form submit to prevent double charges. + jQuery('#payment-request-button').hide(); + }); + function stripeUpdatePaymentRequestButton() { jQuery.noConflict().ajax({ url: pmproStripe.restUrl + 'pmpro/v1/checkout_levels',