Skip to content

Commit d0a252d

Browse files
committed
2 parents c4df6dc + 203fdc0 commit d0a252d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

js/pmpro-stripe.js

+10
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,22 @@ jQuery( document ).ready( function( $ ) {
130130
});
131131
// Handle payment request button confirmation.
132132
paymentRequest.on('paymentmethod', function( event ) {
133+
$('#pmpro_btn-submit').attr('disabled', 'disabled');
134+
$('#pmpro_processing_message').css('visibility', 'visible');
135+
$('#payment-request-button').hide();
136+
event.complete('success');
133137
pmpro_stripeResponseHandler( event );
134138
});
135139
}
136140
}
137141
});
138142

143+
// Find ALL <form> tags on your page
144+
jQuery('form').submit(function(){
145+
// Hide payment request button on form submit to prevent double charges.
146+
jQuery('#payment-request-button').hide();
147+
});
148+
139149
function stripeUpdatePaymentRequestButton() {
140150
jQuery.noConflict().ajax({
141151
url: pmproStripe.restUrl + 'pmpro/v1/checkout_levels',

0 commit comments

Comments
 (0)