WooCommerce Stripe Payment Gateway - Version 5.4.0

Version Description

  • 2021-08-18 =
  • Fix - Do not ask for a Shipping Address if no Shipping Zone is defined.
  • Fix - Return HTTP 204 when webhook validation fails so Stripe won't stop sending certain webhook events after too many failed validations.
  • Fix - Possible use of an undefined variable prepared_source.
  • Add - 'wc_stripe_allowed_payment_processing_statuses' filter to customize order statuses that allow payment processing in the context of 3DS payments.

See changelog for all versions.

Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Stripe Payment Gateway
Version 5.4.0
Comparing to
See all releases

Code changes from version 5.3.0 to 5.4.0

assets/js/stripe.js CHANGED
@@ -253,7 +253,11 @@ jQuery( function( $ ) {
253
  );
254
 
255
  // Subscription early renewals modal.
256
- $( '#early_renewal_modal_submit' ).on( 'click', this.onEarlyRenewalSubmit );
 
 
 
 
257
 
258
  wc_stripe_form.createElements();
259
 
253
  );
254
 
255
  // Subscription early renewals modal.
256
+ if ($('#early_renewal_modal_submit[data-payment-method]').length) {
257
+ $('#early_renewal_modal_submit[data-payment-method=stripe]').on('click', this.onEarlyRenewalSubmit);
258
+ } else {
259
+ $('#early_renewal_modal_submit').on('click', this.onEarlyRenewalSubmit);
260
+ }
261
 
262
  wc_stripe_form.createElements();
263
 
assets/js/stripe.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){"use strict";try{var n=Stripe(wc_stripe_params.key,{locale:wc_stripe_params.stripe_locale||"auto"})}catch(e){return void console.log(e)}var t,o,i,e=Object.keys(wc_stripe_params.elements_options).length?wc_stripe_params.elements_options:{},r=Object.keys(wc_stripe_params.sepa_elements_options).length?wc_stripe_params.sepa_elements_options:{},s=n.elements(e),c=s.create("iban",r),m={getAjaxURL:function(e){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+e)},unmountElements:function(){"yes"===wc_stripe_params.inline_cc_form?t.unmount("#stripe-card-element"):(t.unmount("#stripe-card-element"),o.unmount("#stripe-exp-element"),i.unmount("#stripe-cvc-element"))},mountElements:function(){a("#stripe-card-element").length&&("yes"!==wc_stripe_params.inline_cc_form?(t.mount("#stripe-card-element"),o.mount("#stripe-exp-element"),i.mount("#stripe-cvc-element")):t.mount("#stripe-card-element"))},createElements:function(){var e={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},r={focus:"focused",empty:"empty",invalid:"invalid"},e=wc_stripe_params.elements_styling||e,r=wc_stripe_params.elements_classes||r;"yes"===wc_stripe_params.inline_cc_form?(t=s.create("card",{style:e,hidePostalCode:!0})).addEventListener("change",function(e){m.onCCFormChange(),e.error&&a(document.body).trigger("stripeError",e)}):(t=s.create("cardNumber",{style:e,classes:r}),o=s.create("cardExpiry",{style:e,classes:r}),i=s.create("cardCvc",{style:e,classes:r}),t.addEventListener("change",function(e){m.onCCFormChange(),m.updateCardBrand(e.brand),e.error&&a(document.body).trigger("stripeError",e)}),o.addEventListener("change",function(e){m.onCCFormChange(),e.error&&a(document.body).trigger("stripeError",e)}),i.addEventListener("change",function(e){m.onCCFormChange(),e.error&&a(document.body).trigger("stripeError",e)})),"yes"===wc_stripe_params.is_checkout?a(document.body).on("updated_checkout",function(){a("#stripe-card-element").children().length||(t&&m.unmountElements(),m.mountElements(),a("#stripe-iban-element").length&&c.mount("#stripe-iban-element"))}):(a("form#add_payment_method").length||a("form#order_review").length)&&(m.mountElements(),a("#stripe-iban-element").length&&c.mount("#stripe-iban-element"))},updateCardBrand:function(e){var r={visa:"stripe-visa-brand",mastercard:"stripe-mastercard-brand",amex:"stripe-amex-brand",discover:"stripe-discover-brand",diners:"stripe-diners-brand",jcb:"stripe-jcb-brand",unknown:"stripe-credit-card-brand"},t=a(".stripe-card-brand"),e=e in r?r[e]:"stripe-credit-card-brand";a.each(r,function(e,r){t.removeClass(r)}),t.addClass(e)},init:function(){"yes"!==wc_stripe_params.is_change_payment_page&&"yes"!==wc_stripe_params.is_pay_for_order_page||a(document.body).trigger("wc-credit-card-form-init"),a("form.woocommerce-checkout").length&&(this.form=a("form.woocommerce-checkout")),a("form.woocommerce-checkout").on("checkout_place_order_stripe checkout_place_order_stripe_bancontact checkout_place_order_stripe_sofort checkout_place_order_stripe_giropay checkout_place_order_stripe_ideal checkout_place_order_stripe_alipay checkout_place_order_stripe_sepa",this.onSubmit),a("form#order_review").length&&(this.form=a("form#order_review")),a("form#order_review, form#add_payment_method").on("submit",this.onSubmit),a("form#add_payment_method").length&&(this.form=a("form#add_payment_method")),a("form.woocommerce-checkout").on("change",this.reset),a(document).on("stripeError",this.onError).on("checkout_error",this.reset),c.on("change",this.onSepaError),a("#early_renewal_modal_submit").on("click",this.onEarlyRenewalSubmit),m.createElements(),window.addEventListener("hashchange",m.onHashChange),m.maybeConfirmIntent()},isStripeChosen:function(){return a("#payment_method_stripe, #payment_method_stripe_bancontact, #payment_method_stripe_sofort, #payment_method_stripe_giropay, #payment_method_stripe_ideal, #payment_method_stripe_alipay, #payment_method_stripe_sepa, #payment_method_stripe_eps, #payment_method_stripe_multibanco").is(":checked")||a("#payment_method_stripe").is(":checked")&&"new"===a('input[name="wc-stripe-payment-token"]:checked').val()||a("#payment_method_stripe_sepa").is(":checked")&&"new"===a('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return a("#payment_method_stripe").is(":checked")&&a('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe-payment-token"]:checked').val()||a("#payment_method_stripe_sepa").is(":checked")&&a('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return a("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return a("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return a("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return a("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return a("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return a("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return a("#payment_method_stripe_sepa").is(":checked")},isP24Chosen:function(){return a("#payment_method_stripe_p24").is(":checked")},isEpsChosen:function(){return a("#payment_method_stripe_eps").is(":checked")},isMultibancoChosen:function(){return a("#payment_method_stripe_multibanco").is(":checked")},hasSource:function(){return 0<a("input.stripe-source").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},block:function(){m.isMobile()||m.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){m.form&&m.form.unblock()},getSelectedPaymentElement:function(){return a('.payment_methods input[name="payment_method"]:checked')},getOwnerDetails:function(){var e=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,r=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,t={name:"",address:{},email:"",phone:""};return t.name=e,t.name=e&&r?e+" "+r:a("#stripe-payment-data").data("full-name"),t.email=a("#billing_email").val(),t.phone=a("#billing_phone").val(),(void 0===t.phone||t.phone.length<=0)&&delete t.phone,(void 0===t.email||t.email.length<=0)&&(a("#stripe-payment-data").data("email").length?t.email=a("#stripe-payment-data").data("email"):delete t.email),(void 0===t.name||t.name.length<=0)&&delete t.name,t.address.line1=a("#billing_address_1").val()||wc_stripe_params.billing_address_1,t.address.line2=a("#billing_address_2").val()||wc_stripe_params.billing_address_2,t.address.state=a("#billing_state").val()||wc_stripe_params.billing_state,t.address.city=a("#billing_city").val()||wc_stripe_params.billing_city,t.address.postal_code=a("#billing_postcode").val()||wc_stripe_params.billing_postcode,t.address.country=a("#billing_country").val()||wc_stripe_params.billing_country,{owner:t}},createSource:function(){var e=m.getOwnerDetails();return m.isSepaChosen()?(e.currency=a("#stripe-sepa_debit-payment-data").data("currency"),e.mandate={notification_method:wc_stripe_params.sepa_mandate_notification},e.type="sepa_debit",n.createSource(c,e).then(m.sourceResponse)):n.createSource(t,e).then(m.sourceResponse)},sourceResponse:function(e){e.error?a(document.body).trigger("stripeError",e):(m.reset(),m.form.append(a('<input type="hidden" />').addClass("stripe-source").attr("name","stripe_source").val(e.source.id)),a("form#add_payment_method").length||a("#wc-stripe-change-payment-method").length?m.sourceSetup(e):m.form.trigger("submit"))},sourceSetup:function(r){var e={error:{type:"api_connection_error"}};a.post({url:m.getAjaxURL("create_setup_intent"),dataType:"json",data:{stripe_source_id:r.source.id,nonce:wc_stripe_params.add_card_nonce},error:function(){a(document.body).trigger("stripeError",e)}}).done(function(e){return"success"===e.status?(a("form#add_payment_method").length&&a(m.form).off("submit",m.form.onSubmit),void m.form.trigger("submit")):void("requires_action"===e.status?n.confirmCardSetup(e.client_secret,{payment_method:r.source.id}).then(function(e){e.error?a(document.body).trigger("stripeError",e):(a("form#add_payment_method").length&&a(m.form).off("submit",m.form.onSubmit),m.form.trigger("submit"))}).catch(function(e){console.log(e),a(document.body).trigger("stripeError",{error:e})}):a(document.body).trigger("stripeError",e))})},onSubmit:function(){return!m.isStripeChosen()||(!(!m.isStripeSaveCardChosen()&&!m.hasSource())||(!!(m.isBancontactChosen()||m.isGiropayChosen()||m.isIdealChosen()||m.isAlipayChosen()||m.isSofortChosen()||m.isP24Chosen()||m.isEpsChosen()||m.isMultibancoChosen())||(m.block(),m.createSource(),!1)))},onCCFormChange:function(){m.reset()},reset:function(){a(".wc-stripe-error, .stripe-source").remove()},onSepaError:function(e){var r=m.getSelectedPaymentElement().parents("li").eq(0).find(".stripe-source-errors");e.error?(console.log(e.error.message),a(r).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),a(r).find("li").text(e.error.message)):a(r).html("")},onError:function(e,r){var t,o=r.error.message,n=m.getSelectedPaymentElement().closest("li"),i=n.find(".woocommerce-SavedPaymentMethods-tokenInput"),s=a("body").hasClass("woocommerce-stripe-prb-clicked");if(t=s?(a("body").removeClass("woocommerce-stripe-prb-clicked"),a("div.woocommerce-notices-wrapper").first()):i.length?(t=i.filter(":checked")).closest(".woocommerce-SavedPaymentMethods-new").length?a("#wc-stripe-cc-form .stripe-source-errors"):t.closest("li").find(".stripe-source-errors"):n.find(".stripe-source-errors"),m.isSepaChosen()&&"invalid_owner_name"===r.error.code&&wc_stripe_params.hasOwnProperty(r.error.code)){n=a('<div><ul class="woocommerce-error"><li /></ul></div>');return n.find("li").text(wc_stripe_params[r.error.code]),void m.submitError(n.html())}"email_invalid"===r.error.code?o=wc_stripe_params.email_invalid:"invalid_request_error"!==r.error.type&&"api_connection_error"!==r.error.type&&"api_error"!==r.error.type&&"authentication_error"!==r.error.type&&"rate_limit_error"!==r.error.type||(o=wc_stripe_params.invalid_request_error),"card_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(o=wc_stripe_params[r.error.code]),"validation_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(o=wc_stripe_params[r.error.code]),m.reset(),a(".woocommerce-NoticeGroup-checkout").remove(),console.log(r.error.message),a(t).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),a(t).find("li").text(o),a(".wc-stripe-error").length&&a("html, body").animate({scrollTop:a(".wc-stripe-error").offset().top-200},200),m.unblock(),a.unblockUI()},submitError:function(e){a(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),m.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),m.form.removeClass("processing").unblock(),m.form.find(".input-text, select, input:checkbox").trigger("blur");e="";a("#add_payment_method").length&&(e=a("#add_payment_method")),a("#order_review").length&&(e=a("#order_review")),(e=a("form.checkout").length?a("form.checkout"):e).length&&a("html, body").animate({scrollTop:e.offset().top-100},500),a(document.body).trigger("checkout_error"),m.unblock()},onHashChange:function(){var e,r,t=window.location.hash.match(/^#?confirm-(pi|si)-([^:]+):(.+)$/);!t||t.length<4||(e=t[1],r=t[2],t=decodeURIComponent(t[3]),window.location.hash="",m.openIntentModal(r,t,!1,"si"===e))},maybeConfirmIntent:function(){var e,r;a("#stripe-intent-id").length&&a("#stripe-intent-return").length&&(e=a("#stripe-intent-id").val(),r=a("#stripe-intent-return").val(),m.openIntentModal(e,r,!0,!1))},openIntentModal:function(e,r,t,o){n[o?"handleCardSetup":"handleCardPayment"](e).then(function(e){if(e.error)throw e.error;e=e[o?"setupIntent":"paymentIntent"];"requires_capture"!==e.status&&"succeeded"!==e.status||(window.location=r)}).catch(function(e){t?window.location=r:(a(document.body).trigger("stripeError",{error:e}),m.form&&m.form.removeClass("processing"),a.get(r+"&is_ajax"))})},onEarlyRenewalSubmit:function(e){return e.preventDefault(),a.ajax({url:a("#early_renewal_modal_submit").attr("href"),method:"get",success:function(e){e=JSON.parse(e);e.stripe_sca_required?m.openIntentModal(e.intent_secret,e.redirect_url,!0,!1):window.location=e.redirect_url}}),!1}};m.init()});
1
+ jQuery(function(s){"use strict";try{var n=Stripe(wc_stripe_params.key,{locale:wc_stripe_params.stripe_locale||"auto"})}catch(e){return void console.log(e)}var t,o,i,e=Object.keys(wc_stripe_params.elements_options).length?wc_stripe_params.elements_options:{},r=Object.keys(wc_stripe_params.sepa_elements_options).length?wc_stripe_params.sepa_elements_options:{},a=n.elements(e),c=a.create("iban",r),m={getAjaxURL:function(e){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+e)},unmountElements:function(){"yes"===wc_stripe_params.inline_cc_form?t.unmount("#stripe-card-element"):(t.unmount("#stripe-card-element"),o.unmount("#stripe-exp-element"),i.unmount("#stripe-cvc-element"))},mountElements:function(){s("#stripe-card-element").length&&("yes"!==wc_stripe_params.inline_cc_form?(t.mount("#stripe-card-element"),o.mount("#stripe-exp-element"),i.mount("#stripe-cvc-element")):t.mount("#stripe-card-element"))},createElements:function(){var e={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},r={focus:"focused",empty:"empty",invalid:"invalid"},e=wc_stripe_params.elements_styling||e,r=wc_stripe_params.elements_classes||r;"yes"===wc_stripe_params.inline_cc_form?(t=a.create("card",{style:e,hidePostalCode:!0})).addEventListener("change",function(e){m.onCCFormChange(),e.error&&s(document.body).trigger("stripeError",e)}):(t=a.create("cardNumber",{style:e,classes:r}),o=a.create("cardExpiry",{style:e,classes:r}),i=a.create("cardCvc",{style:e,classes:r}),t.addEventListener("change",function(e){m.onCCFormChange(),m.updateCardBrand(e.brand),e.error&&s(document.body).trigger("stripeError",e)}),o.addEventListener("change",function(e){m.onCCFormChange(),e.error&&s(document.body).trigger("stripeError",e)}),i.addEventListener("change",function(e){m.onCCFormChange(),e.error&&s(document.body).trigger("stripeError",e)})),"yes"===wc_stripe_params.is_checkout?s(document.body).on("updated_checkout",function(){s("#stripe-card-element").children().length||(t&&m.unmountElements(),m.mountElements(),s("#stripe-iban-element").length&&c.mount("#stripe-iban-element"))}):(s("form#add_payment_method").length||s("form#order_review").length)&&(m.mountElements(),s("#stripe-iban-element").length&&c.mount("#stripe-iban-element"))},updateCardBrand:function(e){var r={visa:"stripe-visa-brand",mastercard:"stripe-mastercard-brand",amex:"stripe-amex-brand",discover:"stripe-discover-brand",diners:"stripe-diners-brand",jcb:"stripe-jcb-brand",unknown:"stripe-credit-card-brand"},t=s(".stripe-card-brand"),e=e in r?r[e]:"stripe-credit-card-brand";s.each(r,function(e,r){t.removeClass(r)}),t.addClass(e)},init:function(){"yes"!==wc_stripe_params.is_change_payment_page&&"yes"!==wc_stripe_params.is_pay_for_order_page||s(document.body).trigger("wc-credit-card-form-init"),s("form.woocommerce-checkout").length&&(this.form=s("form.woocommerce-checkout")),s("form.woocommerce-checkout").on("checkout_place_order_stripe checkout_place_order_stripe_bancontact checkout_place_order_stripe_sofort checkout_place_order_stripe_giropay checkout_place_order_stripe_ideal checkout_place_order_stripe_alipay checkout_place_order_stripe_sepa",this.onSubmit),s("form#order_review").length&&(this.form=s("form#order_review")),s("form#order_review, form#add_payment_method").on("submit",this.onSubmit),s("form#add_payment_method").length&&(this.form=s("form#add_payment_method")),s("form.woocommerce-checkout").on("change",this.reset),s(document).on("stripeError",this.onError).on("checkout_error",this.reset),c.on("change",this.onSepaError),(s("#early_renewal_modal_submit[data-payment-method]").length?s("#early_renewal_modal_submit[data-payment-method=stripe]"):s("#early_renewal_modal_submit")).on("click",this.onEarlyRenewalSubmit),m.createElements(),window.addEventListener("hashchange",m.onHashChange),m.maybeConfirmIntent()},isStripeChosen:function(){return s("#payment_method_stripe, #payment_method_stripe_bancontact, #payment_method_stripe_sofort, #payment_method_stripe_giropay, #payment_method_stripe_ideal, #payment_method_stripe_alipay, #payment_method_stripe_sepa, #payment_method_stripe_eps, #payment_method_stripe_multibanco").is(":checked")||s("#payment_method_stripe").is(":checked")&&"new"===s('input[name="wc-stripe-payment-token"]:checked').val()||s("#payment_method_stripe_sepa").is(":checked")&&"new"===s('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return s("#payment_method_stripe").is(":checked")&&s('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==s('input[name="wc-stripe-payment-token"]:checked').val()||s("#payment_method_stripe_sepa").is(":checked")&&s('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==s('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return s("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return s("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return s("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return s("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return s("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return s("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return s("#payment_method_stripe_sepa").is(":checked")},isP24Chosen:function(){return s("#payment_method_stripe_p24").is(":checked")},isEpsChosen:function(){return s("#payment_method_stripe_eps").is(":checked")},isMultibancoChosen:function(){return s("#payment_method_stripe_multibanco").is(":checked")},hasSource:function(){return 0<s("input.stripe-source").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},block:function(){m.isMobile()||m.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){m.form&&m.form.unblock()},getSelectedPaymentElement:function(){return s('.payment_methods input[name="payment_method"]:checked')},getOwnerDetails:function(){var e=s("#billing_first_name").length?s("#billing_first_name").val():wc_stripe_params.billing_first_name,r=s("#billing_last_name").length?s("#billing_last_name").val():wc_stripe_params.billing_last_name,t={name:"",address:{},email:"",phone:""};return t.name=e,t.name=e&&r?e+" "+r:s("#stripe-payment-data").data("full-name"),t.email=s("#billing_email").val(),t.phone=s("#billing_phone").val(),(void 0===t.phone||t.phone.length<=0)&&delete t.phone,(void 0===t.email||t.email.length<=0)&&(s("#stripe-payment-data").data("email").length?t.email=s("#stripe-payment-data").data("email"):delete t.email),(void 0===t.name||t.name.length<=0)&&delete t.name,t.address.line1=s("#billing_address_1").val()||wc_stripe_params.billing_address_1,t.address.line2=s("#billing_address_2").val()||wc_stripe_params.billing_address_2,t.address.state=s("#billing_state").val()||wc_stripe_params.billing_state,t.address.city=s("#billing_city").val()||wc_stripe_params.billing_city,t.address.postal_code=s("#billing_postcode").val()||wc_stripe_params.billing_postcode,t.address.country=s("#billing_country").val()||wc_stripe_params.billing_country,{owner:t}},createSource:function(){var e=m.getOwnerDetails();return m.isSepaChosen()?(e.currency=s("#stripe-sepa_debit-payment-data").data("currency"),e.mandate={notification_method:wc_stripe_params.sepa_mandate_notification},e.type="sepa_debit",n.createSource(c,e).then(m.sourceResponse)):n.createSource(t,e).then(m.sourceResponse)},sourceResponse:function(e){e.error?s(document.body).trigger("stripeError",e):(m.reset(),m.form.append(s('<input type="hidden" />').addClass("stripe-source").attr("name","stripe_source").val(e.source.id)),s("form#add_payment_method").length||s("#wc-stripe-change-payment-method").length?m.sourceSetup(e):m.form.trigger("submit"))},sourceSetup:function(r){var e={error:{type:"api_connection_error"}};s.post({url:m.getAjaxURL("create_setup_intent"),dataType:"json",data:{stripe_source_id:r.source.id,nonce:wc_stripe_params.add_card_nonce},error:function(){s(document.body).trigger("stripeError",e)}}).done(function(e){return"success"===e.status?(s("form#add_payment_method").length&&s(m.form).off("submit",m.form.onSubmit),void m.form.trigger("submit")):void("requires_action"===e.status?n.confirmCardSetup(e.client_secret,{payment_method:r.source.id}).then(function(e){e.error?s(document.body).trigger("stripeError",e):(s("form#add_payment_method").length&&s(m.form).off("submit",m.form.onSubmit),m.form.trigger("submit"))}).catch(function(e){console.log(e),s(document.body).trigger("stripeError",{error:e})}):s(document.body).trigger("stripeError",e))})},onSubmit:function(){return!m.isStripeChosen()||(!(!m.isStripeSaveCardChosen()&&!m.hasSource())||(!!(m.isBancontactChosen()||m.isGiropayChosen()||m.isIdealChosen()||m.isAlipayChosen()||m.isSofortChosen()||m.isP24Chosen()||m.isEpsChosen()||m.isMultibancoChosen())||(m.block(),m.createSource(),!1)))},onCCFormChange:function(){m.reset()},reset:function(){s(".wc-stripe-error, .stripe-source").remove()},onSepaError:function(e){var r=m.getSelectedPaymentElement().parents("li").eq(0).find(".stripe-source-errors");e.error?(console.log(e.error.message),s(r).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),s(r).find("li").text(e.error.message)):s(r).html("")},onError:function(e,r){var t,o=r.error.message,n=m.getSelectedPaymentElement().closest("li"),i=n.find(".woocommerce-SavedPaymentMethods-tokenInput"),a=s("body").hasClass("woocommerce-stripe-prb-clicked");if(t=a?(s("body").removeClass("woocommerce-stripe-prb-clicked"),s("div.woocommerce-notices-wrapper").first()):i.length?(t=i.filter(":checked")).closest(".woocommerce-SavedPaymentMethods-new").length?s("#wc-stripe-cc-form .stripe-source-errors"):t.closest("li").find(".stripe-source-errors"):n.find(".stripe-source-errors"),m.isSepaChosen()&&"invalid_owner_name"===r.error.code&&wc_stripe_params.hasOwnProperty(r.error.code)){n=s('<div><ul class="woocommerce-error"><li /></ul></div>');return n.find("li").text(wc_stripe_params[r.error.code]),void m.submitError(n.html())}"email_invalid"===r.error.code?o=wc_stripe_params.email_invalid:"invalid_request_error"!==r.error.type&&"api_connection_error"!==r.error.type&&"api_error"!==r.error.type&&"authentication_error"!==r.error.type&&"rate_limit_error"!==r.error.type||(o=wc_stripe_params.invalid_request_error),"card_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(o=wc_stripe_params[r.error.code]),"validation_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(o=wc_stripe_params[r.error.code]),m.reset(),s(".woocommerce-NoticeGroup-checkout").remove(),console.log(r.error.message),s(t).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),s(t).find("li").text(o),s(".wc-stripe-error").length&&s("html, body").animate({scrollTop:s(".wc-stripe-error").offset().top-200},200),m.unblock(),s.unblockUI()},submitError:function(e){s(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),m.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),m.form.removeClass("processing").unblock(),m.form.find(".input-text, select, input:checkbox").trigger("blur");e="";s("#add_payment_method").length&&(e=s("#add_payment_method")),s("#order_review").length&&(e=s("#order_review")),(e=s("form.checkout").length?s("form.checkout"):e).length&&s("html, body").animate({scrollTop:e.offset().top-100},500),s(document.body).trigger("checkout_error"),m.unblock()},onHashChange:function(){var e,r,t=window.location.hash.match(/^#?confirm-(pi|si)-([^:]+):(.+)$/);!t||t.length<4||(e=t[1],r=t[2],t=decodeURIComponent(t[3]),window.location.hash="",m.openIntentModal(r,t,!1,"si"===e))},maybeConfirmIntent:function(){var e,r;s("#stripe-intent-id").length&&s("#stripe-intent-return").length&&(e=s("#stripe-intent-id").val(),r=s("#stripe-intent-return").val(),m.openIntentModal(e,r,!0,!1))},openIntentModal:function(e,r,t,o){n[o?"handleCardSetup":"handleCardPayment"](e).then(function(e){if(e.error)throw e.error;e=e[o?"setupIntent":"paymentIntent"];"requires_capture"!==e.status&&"succeeded"!==e.status||(window.location=r)}).catch(function(e){t?window.location=r:(s(document.body).trigger("stripeError",{error:e}),m.form&&m.form.removeClass("processing"),s.get(r+"&is_ajax"))})},onEarlyRenewalSubmit:function(e){return e.preventDefault(),s.ajax({url:s("#early_renewal_modal_submit").attr("href"),method:"get",success:function(e){e=JSON.parse(e);e.stripe_sca_required?m.openIntentModal(e.intent_secret,e.redirect_url,!0,!1):window.location=e.redirect_url}}),!1}};m.init()});
changelog.txt CHANGED
@@ -1,5 +1,11 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
 
3
  = 5.3.0 - 2021-07-21 =
4
  * Fix - Disable Payment Request Buttons when order has to be split into multiple packages because Payment Requests do not support that use case.
5
  * Tweak - Payment request button should guide users to login when necessary.
1
  *** Changelog ***
2
 
3
+ = 5.4.0 - 2021-08-18 =
4
+ * Fix - Do not ask for a Shipping Address if no Shipping Zone is defined.
5
+ * Fix - Return HTTP 204 when webhook validation fails so Stripe won't stop sending certain webhook events after too many failed validations.
6
+ * Fix - Possible use of an undefined variable `prepared_source`.
7
+ * Add - 'wc_stripe_allowed_payment_processing_statuses' filter to customize order statuses that allow payment processing in the context of 3DS payments.
8
+
9
  = 5.3.0 - 2021-07-21 =
10
  * Fix - Disable Payment Request Buttons when order has to be split into multiple packages because Payment Requests do not support that use case.
11
  * Tweak - Payment request button should guide users to login when necessary.
includes/abstracts/abstract-wc-stripe-payment-gateway.php CHANGED
@@ -728,7 +728,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
728
  if ( $order ) {
729
  $order_id = $order->get_id();
730
 
731
- $stripe_customer_id = get_post_meta( $order_id, '_stripe_customer_id', true );
732
 
733
  if ( $stripe_customer_id ) {
734
  $stripe_customer->set_id( $stripe_customer_id );
728
  if ( $order ) {
729
  $order_id = $order->get_id();
730
 
731
+ $stripe_customer_id = $this->get_stripe_customer_id( $order );
732
 
733
  if ( $stripe_customer_id ) {
734
  $stripe_customer->set_id( $stripe_customer_id );
includes/class-wc-gateway-stripe.php CHANGED
@@ -1110,7 +1110,12 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
1110
  clean_post_cache( $order->get_id() );
1111
  $order = wc_get_order( $order->get_id() );
1112
 
1113
- if ( ! $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
1114
  // If payment has already been completed, this function is redundant.
1115
  return;
1116
  }
@@ -1309,7 +1314,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
1309
  if ( ! is_wp_error( $oauth_url ) ) {
1310
  $api_credentials_text = sprintf(
1311
  /* translators: %1, %2 and %3 are all HTML markup tags */
1312
- __( '%1$sSetup or link an existing Stripe account.%2$s By clicking this button you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe account keys below.', 'woocommerce-gateway-stripe' ),
1313
  '<a id="wc_stripe_connect_button" href="' . $oauth_url . '" class="button button-primary">',
1314
  '</a>',
1315
  '<a href="https://wordpress.com/tos">'
1110
  clean_post_cache( $order->get_id() );
1111
  $order = wc_get_order( $order->get_id() );
1112
 
1113
+ if ( ! $order->has_status(
1114
+ apply_filters(
1115
+ 'wc_stripe_allowed_payment_processing_statuses',
1116
+ [ 'pending', 'failed' ]
1117
+ )
1118
+ ) ) {
1119
  // If payment has already been completed, this function is redundant.
1120
  return;
1121
  }
1314
  if ( ! is_wp_error( $oauth_url ) ) {
1315
  $api_credentials_text = sprintf(
1316
  /* translators: %1, %2 and %3 are all HTML markup tags */
1317
+ __( '%1$sSet up or link an existing Stripe account.%2$s By clicking this button you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe account keys below.', 'woocommerce-gateway-stripe' ),
1318
  '<a id="wc_stripe_connect_button" href="' . $oauth_url . '" class="button button-primary">',
1319
  '</a>',
1320
  '<a href="https://wordpress.com/tos">'
includes/class-wc-stripe-order-handler.php CHANGED
@@ -107,22 +107,19 @@ class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
107
  }
108
 
109
  // Prep source object.
110
- $source_object = new stdClass();
111
- $source_object->token_id = '';
112
- $source_object->customer = $this->get_stripe_customer_id( $order );
113
- $source_object->source = $source_info->id;
114
- $source_object->status = 'chargeable';
115
 
116
  /*
117
  * If we're doing a retry and source is chargeable, we need to pass
118
  * a different idempotency key and retry for success.
119
  */
120
- if ( $this->need_update_idempotency_key( $source_object, $previous_error ) ) {
121
  add_filter( 'wc_stripe_idempotency_key', [ $this, 'change_idempotency_key' ], 10, 2 );
122
  }
123
 
124
  // Make the request.
125
- $response = WC_Stripe_API::request( $this->generate_payment_request( $order, $source_object ), 'charges', 'POST', true );
126
  $headers = $response['headers'];
127
  $response = $response['body'];
128
 
107
  }
108
 
109
  // Prep source object.
110
+ $prepared_source = $this->prepare_order_source( $order );
111
+ $prepared_source->status = 'chargeable';
 
 
 
112
 
113
  /*
114
  * If we're doing a retry and source is chargeable, we need to pass
115
  * a different idempotency key and retry for success.
116
  */
117
+ if ( $this->need_update_idempotency_key( $prepared_source, $previous_error ) ) {
118
  add_filter( 'wc_stripe_idempotency_key', [ $this, 'change_idempotency_key' ], 10, 2 );
119
  }
120
 
121
  // Make the request.
122
+ $response = WC_Stripe_API::request( $this->generate_payment_request( $order, $prepared_source ), 'charges', 'POST', true );
123
  $headers = $response['headers'];
124
  $response = $response['body'];
125
 
includes/class-wc-stripe-webhook-handler.php CHANGED
@@ -86,7 +86,10 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
86
  WC_Stripe_Webhook_State::set_last_webhook_failure_at( time() );
87
  WC_Stripe_Webhook_State::set_last_error_reason( $validation_result );
88
 
89
- status_header( 400 );
 
 
 
90
  exit;
91
  }
92
  }
@@ -197,8 +200,7 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
197
  return;
198
  }
199
 
200
- $order_id = $order->get_id();
201
- $source_id = $notification->data->object->id;
202
 
203
  $is_pending_receiver = ( 'receiver' === $notification->data->object->flow );
204
 
@@ -220,13 +222,10 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
220
  WC_Stripe_Logger::log( "Info: (Webhook) Begin processing payment for order $order_id for the amount of {$order->get_total()}" );
221
 
222
  // Prep source object.
223
- $source_object = new stdClass();
224
- $source_object->token_id = '';
225
- $source_object->customer = $this->get_stripe_customer_id( $order );
226
- $source_object->source = $source_id;
227
 
228
  // Make the request.
229
- $response = WC_Stripe_API::request( $this->generate_payment_request( $order, $source_object ), 'charges', 'POST', true );
230
  $headers = $response['headers'];
231
  $response = $response['body'];
232
 
@@ -743,7 +742,12 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
743
  return;
744
  }
745
 
746
- if ( ! $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
747
  return;
748
  }
749
 
@@ -790,7 +794,12 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
790
  return;
791
  }
792
 
793
- if ( ! $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
794
  return;
795
  }
796
 
86
  WC_Stripe_Webhook_State::set_last_webhook_failure_at( time() );
87
  WC_Stripe_Webhook_State::set_last_error_reason( $validation_result );
88
 
89
+ // A webhook endpoint must return a 2xx HTTP status code to prevent future webhook
90
+ // delivery failures.
91
+ // @see https://stripe.com/docs/webhooks/build#acknowledge-events-immediately
92
+ status_header( 204 );
93
  exit;
94
  }
95
  }
200
  return;
201
  }
202
 
203
+ $order_id = $order->get_id();
 
204
 
205
  $is_pending_receiver = ( 'receiver' === $notification->data->object->flow );
206
 
222
  WC_Stripe_Logger::log( "Info: (Webhook) Begin processing payment for order $order_id for the amount of {$order->get_total()}" );
223
 
224
  // Prep source object.
225
+ $prepared_source = $this->prepare_order_source( $order );
 
 
 
226
 
227
  // Make the request.
228
+ $response = WC_Stripe_API::request( $this->generate_payment_request( $order, $prepared_source ), 'charges', 'POST', true );
229
  $headers = $response['headers'];
230
  $response = $response['body'];
231
 
742
  return;
743
  }
744
 
745
+ if ( ! $order->has_status(
746
+ apply_filters(
747
+ 'wc_stripe_allowed_payment_processing_statuses',
748
+ [ 'pending', 'failed' ]
749
+ )
750
+ ) ) {
751
  return;
752
  }
753
 
794
  return;
795
  }
796
 
797
+ if ( ! $order->has_status(
798
+ apply_filters(
799
+ 'wc_gateway_stripe_allowed_payment_processing_statuses',
800
+ [ 'pending', 'failed' ]
801
+ )
802
+ ) ) {
803
  return;
804
  }
805
 
includes/payment-methods/class-wc-gateway-stripe-alipay.php CHANGED
@@ -281,7 +281,10 @@ class WC_Gateway_Stripe_Alipay extends WC_Stripe_Payment_Gateway {
281
 
282
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
283
 
284
- $statuses = [ 'pending', 'failed' ];
 
 
 
285
 
286
  if ( $order->has_status( $statuses ) ) {
287
  $this->send_failed_order_email( $order_id );
281
 
282
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
283
 
284
+ $statuses = apply_filters(
285
+ 'wc_stripe_allowed_payment_processing_statuses',
286
+ [ 'pending', 'failed' ]
287
+ );
288
 
289
  if ( $order->has_status( $statuses ) ) {
290
  $this->send_failed_order_email( $order_id );
includes/payment-methods/class-wc-gateway-stripe-bancontact.php CHANGED
@@ -270,7 +270,12 @@ class WC_Gateway_Stripe_Bancontact extends WC_Stripe_Payment_Gateway {
270
 
271
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
272
 
273
- if ( $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
274
  $this->send_failed_order_email( $order_id );
275
  }
276
 
270
 
271
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
272
 
273
+ if ( $order->has_status(
274
+ apply_filters(
275
+ 'wc_stripe_allowed_payment_processing_statuses',
276
+ [ 'pending', 'failed' ]
277
+ )
278
+ ) ) {
279
  $this->send_failed_order_email( $order_id );
280
  }
281
 
includes/payment-methods/class-wc-gateway-stripe-eps.php CHANGED
@@ -269,7 +269,12 @@ class WC_Gateway_Stripe_Eps extends WC_Stripe_Payment_Gateway {
269
 
270
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
271
 
272
- if ( $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
273
  $this->send_failed_order_email( $order_id );
274
  }
275
 
269
 
270
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
271
 
272
+ if ( $order->has_status(
273
+ apply_filters(
274
+ 'wc_stripe_allowed_payment_processing_statuses',
275
+ [ 'pending', 'failed' ]
276
+ )
277
+ ) ) {
278
  $this->send_failed_order_email( $order_id );
279
  }
280
 
includes/payment-methods/class-wc-gateway-stripe-giropay.php CHANGED
@@ -269,7 +269,12 @@ class WC_Gateway_Stripe_Giropay extends WC_Stripe_Payment_Gateway {
269
 
270
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
271
 
272
- if ( $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
273
  $this->send_failed_order_email( $order_id );
274
  }
275
 
269
 
270
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
271
 
272
+ if ( $order->has_status(
273
+ apply_filters(
274
+ 'wc_stripe_allowed_payment_processing_statuses',
275
+ [ 'pending', 'failed' ]
276
+ )
277
+ ) ) {
278
  $this->send_failed_order_email( $order_id );
279
  }
280
 
includes/payment-methods/class-wc-gateway-stripe-ideal.php CHANGED
@@ -269,7 +269,12 @@ class WC_Gateway_Stripe_Ideal extends WC_Stripe_Payment_Gateway {
269
 
270
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
271
 
272
- if ( $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
273
  $this->send_failed_order_email( $order_id );
274
  }
275
 
269
 
270
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
271
 
272
+ if ( $order->has_status(
273
+ apply_filters(
274
+ 'wc_stripe_allowed_payment_processing_statuses',
275
+ [ 'pending', 'failed' ]
276
+ )
277
+ ) ) {
278
  $this->send_failed_order_email( $order_id );
279
  }
280
 
includes/payment-methods/class-wc-gateway-stripe-multibanco.php CHANGED
@@ -376,7 +376,12 @@ class WC_Gateway_Stripe_Multibanco extends WC_Stripe_Payment_Gateway {
376
 
377
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
378
 
379
- if ( $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
380
  $this->send_failed_order_email( $order_id );
381
  }
382
 
376
 
377
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
378
 
379
+ if ( $order->has_status(
380
+ apply_filters(
381
+ 'wc_stripe_allowed_payment_processing_statuses',
382
+ [ 'pending', 'failed' ]
383
+ )
384
+ ) ) {
385
  $this->send_failed_order_email( $order_id );
386
  }
387
 
includes/payment-methods/class-wc-gateway-stripe-p24.php CHANGED
@@ -266,7 +266,12 @@ class WC_Gateway_Stripe_P24 extends WC_Stripe_Payment_Gateway {
266
 
267
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
268
 
269
- if ( $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
270
  $this->send_failed_order_email( $order_id );
271
  }
272
 
266
 
267
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
268
 
269
+ if ( $order->has_status(
270
+ apply_filters(
271
+ 'wc_stripe_allowed_payment_processing_statuses',
272
+ [ 'pending', 'failed' ]
273
+ )
274
+ ) ) {
275
  $this->send_failed_order_email( $order_id );
276
  }
277
 
includes/payment-methods/class-wc-gateway-stripe-sepa.php CHANGED
@@ -405,7 +405,12 @@ class WC_Gateway_Stripe_Sepa extends WC_Stripe_Payment_Gateway {
405
 
406
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
407
 
408
- if ( $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
409
  $this->send_failed_order_email( $order_id );
410
  }
411
 
405
 
406
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
407
 
408
+ if ( $order->has_status(
409
+ apply_filters(
410
+ 'wc_stripe_allowed_payment_processing_statuses',
411
+ [ 'pending', 'failed' ]
412
+ )
413
+ ) ) {
414
  $this->send_failed_order_email( $order_id );
415
  }
416
 
includes/payment-methods/class-wc-gateway-stripe-sofort.php CHANGED
@@ -282,7 +282,12 @@ class WC_Gateway_Stripe_Sofort extends WC_Stripe_Payment_Gateway {
282
 
283
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
284
 
285
- if ( $order->has_status( [ 'pending', 'failed' ] ) ) {
 
 
 
 
 
286
  $this->send_failed_order_email( $order_id );
287
  }
288
 
282
 
283
  do_action( 'wc_gateway_stripe_process_payment_error', $e, $order );
284
 
285
+ if ( $order->has_status(
286
+ apply_filters(
287
+ 'wc_stripe_allowed_payment_processing_statuses',
288
+ [ 'pending', 'failed' ]
289
+ )
290
+ ) ) {
291
  $this->send_failed_order_email( $order_id );
292
  }
293
 
includes/payment-methods/class-wc-stripe-payment-request.php CHANGED
@@ -417,7 +417,7 @@ class WC_Stripe_Payment_Request {
417
  'pending' => true,
418
  ];
419
 
420
- $data['requestShipping'] = ( wc_shipping_enabled() && $product->needs_shipping() );
421
  $data['currency'] = strtolower( get_woocommerce_currency() );
422
  $data['country_code'] = substr( get_option( 'woocommerce_default_country' ), 0, 2 );
423
 
417
  'pending' => true,
418
  ];
419
 
420
+ $data['requestShipping'] = ( wc_shipping_enabled() && $product->needs_shipping() && 0 !== wc_get_shipping_method_count( true ) );
421
  $data['currency'] = strtolower( get_woocommerce_currency() );
422
  $data['country_code'] = substr( get_option( 'woocommerce_default_country' ), 0, 2 );
423
 
languages/woocommerce-gateway-stripe.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Stripe Gateway 5.3.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
8
- "POT-Creation-Date: 2021-07-21 19:34:48+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -56,9 +56,9 @@ msgid "Stripe charge awaiting payment: %s."
56
  msgstr ""
57
 
58
  #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:462
59
- #: includes/class-wc-stripe-order-handler.php:299
60
- #: includes/class-wc-stripe-webhook-handler.php:415
61
- #: includes/class-wc-stripe-webhook-handler.php:465
62
  #. translators: transaction id
63
  msgid "Stripe charge complete (Charge ID: %s)"
64
  msgstr ""
@@ -985,8 +985,8 @@ msgid "Stripe Payout:"
985
  msgstr ""
986
 
987
  #: includes/class-wc-gateway-stripe.php:872
988
- #: includes/class-wc-stripe-order-handler.php:159
989
- #: includes/class-wc-stripe-webhook-handler.php:264
990
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:287
991
  #: includes/compat/class-wc-stripe-subs-compat.php:339
992
  #: includes/payment-methods/class-wc-gateway-stripe-sepa.php:366
@@ -1008,57 +1008,57 @@ msgstr ""
1008
  msgid "Payment Intent not found for order #%s"
1009
  msgstr ""
1010
 
1011
- #: includes/class-wc-gateway-stripe.php:1178
1012
- #: includes/class-wc-stripe-webhook-handler.php:768
1013
- #: includes/class-wc-stripe-webhook-handler.php:813
1014
  #. translators: 1) The error message that was received from Stripe.
1015
  msgid "Stripe SCA authentication failed. Reason: %s"
1016
  msgstr ""
1017
 
1018
- #: includes/class-wc-gateway-stripe.php:1179
1019
  msgid "Stripe SCA authentication failed."
1020
  msgstr ""
1021
 
1022
- #: includes/class-wc-gateway-stripe.php:1236
1023
  msgid ""
1024
  "The \"Live Publishable Key\" should start with \"pk_live\", enter the "
1025
  "correct key."
1026
  msgstr ""
1027
 
1028
- #: includes/class-wc-gateway-stripe.php:1244
1029
  msgid ""
1030
  "The \"Live Secret Key\" should start with \"sk_live\" or \"rk_live\", enter "
1031
  "the correct key."
1032
  msgstr ""
1033
 
1034
- #: includes/class-wc-gateway-stripe.php:1252
1035
  msgid ""
1036
  "The \"Test Publishable Key\" should start with \"pk_test\", enter the "
1037
  "correct key."
1038
  msgstr ""
1039
 
1040
- #: includes/class-wc-gateway-stripe.php:1260
1041
  msgid ""
1042
  "The \"Test Secret Key\" should start with \"sk_test\" or \"rk_test\", enter "
1043
  "the correct key."
1044
  msgstr ""
1045
 
1046
- #: includes/class-wc-gateway-stripe.php:1300
1047
  #. translators: %1, %2, %3, and %4 are all HTML markup tags
1048
  msgid ""
1049
  "%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection "
1050
  "to Stripe.%4$s"
1051
  msgstr ""
1052
 
1053
- #: includes/class-wc-gateway-stripe.php:1312
1054
  #. translators: %1, %2 and %3 are all HTML markup tags
1055
  msgid ""
1056
- "%1$sSetup or link an existing Stripe account.%2$s By clicking this button "
1057
  "you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe "
1058
  "account keys below."
1059
  msgstr ""
1060
 
1061
- #: includes/class-wc-gateway-stripe.php:1318
1062
  msgid "Manually enter Stripe keys below."
1063
  msgstr ""
1064
 
@@ -1258,21 +1258,21 @@ msgstr ""
1258
  msgid "Failed to save payment method."
1259
  msgstr ""
1260
 
1261
- #: includes/class-wc-stripe-order-handler.php:141
1262
- #: includes/class-wc-stripe-webhook-handler.php:245
1263
  #: includes/payment-methods/class-wc-gateway-stripe-sepa.php:346
1264
  msgid "This card is no longer available and has been removed."
1265
  msgstr ""
1266
 
1267
- #: includes/class-wc-stripe-order-handler.php:191
1268
  #. translators: error message
1269
  msgid "Stripe payment failed: %s"
1270
  msgstr ""
1271
 
1272
- #: includes/class-wc-stripe-order-handler.php:242
1273
- #: includes/class-wc-stripe-order-handler.php:257
1274
- #: includes/class-wc-stripe-order-handler.php:273
1275
- #: includes/class-wc-stripe-order-handler.php:288
1276
  #. translators: error message
1277
  msgid "Unable to capture charge! %s"
1278
  msgstr ""
@@ -1286,7 +1286,7 @@ msgstr ""
1286
  msgid "SEPA IBAN ending in %s"
1287
  msgstr ""
1288
 
1289
- #: includes/class-wc-stripe-webhook-handler.php:324
1290
  #. translators: 1) The URL to the order.
1291
  msgid ""
1292
  "A dispute was created for this order. Response is needed. Please go to your "
@@ -1294,47 +1294,47 @@ msgid ""
1294
  "Dashboard</a> to review this dispute."
1295
  msgstr ""
1296
 
1297
- #: includes/class-wc-stripe-webhook-handler.php:353
1298
  msgid "The dispute was lost or accepted."
1299
  msgstr ""
1300
 
1301
- #: includes/class-wc-stripe-webhook-handler.php:355
1302
  msgid "The dispute was resolved in your favor."
1303
  msgstr ""
1304
 
1305
- #: includes/class-wc-stripe-webhook-handler.php:357
1306
  msgid "The inquiry or retrieval was closed."
1307
  msgstr ""
1308
 
1309
- #: includes/class-wc-stripe-webhook-handler.php:410
1310
  #. translators: partial captured amount
1311
  msgid "This charge was partially captured via Stripe Dashboard in the amount of: %s"
1312
  msgstr ""
1313
 
1314
- #: includes/class-wc-stripe-webhook-handler.php:492
1315
  msgid "This payment failed to clear."
1316
  msgstr ""
1317
 
1318
- #: includes/class-wc-stripe-webhook-handler.php:529
1319
  msgid "This payment was cancelled."
1320
  msgstr ""
1321
 
1322
- #: includes/class-wc-stripe-webhook-handler.php:572
1323
  #. translators: amount (including currency symbol)
1324
  msgid "Pre-Authorization for %s voided from the Stripe Dashboard."
1325
  msgstr ""
1326
 
1327
- #: includes/class-wc-stripe-webhook-handler.php:585
1328
  msgid "Refunded via Stripe Dashboard"
1329
  msgstr ""
1330
 
1331
- #: includes/class-wc-stripe-webhook-handler.php:607
1332
  #. translators: 1) amount (including currency symbol) 2) transaction id 3)
1333
  #. refund message
1334
  msgid "Refunded %1$s - Refund ID: %2$s - %3$s"
1335
  msgstr ""
1336
 
1337
- #: includes/class-wc-stripe-webhook-handler.php:638
1338
  #. translators: 1) The URL to the order. 2) The reason type.
1339
  msgid ""
1340
  "A review has been opened for this order. Action is needed. Please go to "
@@ -1342,7 +1342,7 @@ msgid ""
1342
  "Dashboard</a> to review the issue. Reason: (%2$s)"
1343
  msgstr ""
1344
 
1345
- #: includes/class-wc-stripe-webhook-handler.php:671
1346
  #. translators: 1) The reason type.
1347
  msgid "The opened review for this order is now closed. Reason: (%s)"
1348
  msgstr ""
2
  # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Stripe Gateway 5.4.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
8
+ "POT-Creation-Date: 2021-08-18 18:54:29+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
56
  msgstr ""
57
 
58
  #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:462
59
+ #: includes/class-wc-stripe-order-handler.php:296
60
+ #: includes/class-wc-stripe-webhook-handler.php:414
61
+ #: includes/class-wc-stripe-webhook-handler.php:464
62
  #. translators: transaction id
63
  msgid "Stripe charge complete (Charge ID: %s)"
64
  msgstr ""
985
  msgstr ""
986
 
987
  #: includes/class-wc-gateway-stripe.php:872
988
+ #: includes/class-wc-stripe-order-handler.php:156
989
+ #: includes/class-wc-stripe-webhook-handler.php:263
990
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:287
991
  #: includes/compat/class-wc-stripe-subs-compat.php:339
992
  #: includes/payment-methods/class-wc-gateway-stripe-sepa.php:366
1008
  msgid "Payment Intent not found for order #%s"
1009
  msgstr ""
1010
 
1011
+ #: includes/class-wc-gateway-stripe.php:1183
1012
+ #: includes/class-wc-stripe-webhook-handler.php:772
1013
+ #: includes/class-wc-stripe-webhook-handler.php:822
1014
  #. translators: 1) The error message that was received from Stripe.
1015
  msgid "Stripe SCA authentication failed. Reason: %s"
1016
  msgstr ""
1017
 
1018
+ #: includes/class-wc-gateway-stripe.php:1184
1019
  msgid "Stripe SCA authentication failed."
1020
  msgstr ""
1021
 
1022
+ #: includes/class-wc-gateway-stripe.php:1241
1023
  msgid ""
1024
  "The \"Live Publishable Key\" should start with \"pk_live\", enter the "
1025
  "correct key."
1026
  msgstr ""
1027
 
1028
+ #: includes/class-wc-gateway-stripe.php:1249
1029
  msgid ""
1030
  "The \"Live Secret Key\" should start with \"sk_live\" or \"rk_live\", enter "
1031
  "the correct key."
1032
  msgstr ""
1033
 
1034
+ #: includes/class-wc-gateway-stripe.php:1257
1035
  msgid ""
1036
  "The \"Test Publishable Key\" should start with \"pk_test\", enter the "
1037
  "correct key."
1038
  msgstr ""
1039
 
1040
+ #: includes/class-wc-gateway-stripe.php:1265
1041
  msgid ""
1042
  "The \"Test Secret Key\" should start with \"sk_test\" or \"rk_test\", enter "
1043
  "the correct key."
1044
  msgstr ""
1045
 
1046
+ #: includes/class-wc-gateway-stripe.php:1305
1047
  #. translators: %1, %2, %3, and %4 are all HTML markup tags
1048
  msgid ""
1049
  "%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection "
1050
  "to Stripe.%4$s"
1051
  msgstr ""
1052
 
1053
+ #: includes/class-wc-gateway-stripe.php:1317
1054
  #. translators: %1, %2 and %3 are all HTML markup tags
1055
  msgid ""
1056
+ "%1$sSet up or link an existing Stripe account.%2$s By clicking this button "
1057
  "you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe "
1058
  "account keys below."
1059
  msgstr ""
1060
 
1061
+ #: includes/class-wc-gateway-stripe.php:1323
1062
  msgid "Manually enter Stripe keys below."
1063
  msgstr ""
1064
 
1258
  msgid "Failed to save payment method."
1259
  msgstr ""
1260
 
1261
+ #: includes/class-wc-stripe-order-handler.php:138
1262
+ #: includes/class-wc-stripe-webhook-handler.php:244
1263
  #: includes/payment-methods/class-wc-gateway-stripe-sepa.php:346
1264
  msgid "This card is no longer available and has been removed."
1265
  msgstr ""
1266
 
1267
+ #: includes/class-wc-stripe-order-handler.php:188
1268
  #. translators: error message
1269
  msgid "Stripe payment failed: %s"
1270
  msgstr ""
1271
 
1272
+ #: includes/class-wc-stripe-order-handler.php:239
1273
+ #: includes/class-wc-stripe-order-handler.php:254
1274
+ #: includes/class-wc-stripe-order-handler.php:270
1275
+ #: includes/class-wc-stripe-order-handler.php:285
1276
  #. translators: error message
1277
  msgid "Unable to capture charge! %s"
1278
  msgstr ""
1286
  msgid "SEPA IBAN ending in %s"
1287
  msgstr ""
1288
 
1289
+ #: includes/class-wc-stripe-webhook-handler.php:323
1290
  #. translators: 1) The URL to the order.
1291
  msgid ""
1292
  "A dispute was created for this order. Response is needed. Please go to your "
1294
  "Dashboard</a> to review this dispute."
1295
  msgstr ""
1296
 
1297
+ #: includes/class-wc-stripe-webhook-handler.php:352
1298
  msgid "The dispute was lost or accepted."
1299
  msgstr ""
1300
 
1301
+ #: includes/class-wc-stripe-webhook-handler.php:354
1302
  msgid "The dispute was resolved in your favor."
1303
  msgstr ""
1304
 
1305
+ #: includes/class-wc-stripe-webhook-handler.php:356
1306
  msgid "The inquiry or retrieval was closed."
1307
  msgstr ""
1308
 
1309
+ #: includes/class-wc-stripe-webhook-handler.php:409
1310
  #. translators: partial captured amount
1311
  msgid "This charge was partially captured via Stripe Dashboard in the amount of: %s"
1312
  msgstr ""
1313
 
1314
+ #: includes/class-wc-stripe-webhook-handler.php:491
1315
  msgid "This payment failed to clear."
1316
  msgstr ""
1317
 
1318
+ #: includes/class-wc-stripe-webhook-handler.php:528
1319
  msgid "This payment was cancelled."
1320
  msgstr ""
1321
 
1322
+ #: includes/class-wc-stripe-webhook-handler.php:571
1323
  #. translators: amount (including currency symbol)
1324
  msgid "Pre-Authorization for %s voided from the Stripe Dashboard."
1325
  msgstr ""
1326
 
1327
+ #: includes/class-wc-stripe-webhook-handler.php:584
1328
  msgid "Refunded via Stripe Dashboard"
1329
  msgstr ""
1330
 
1331
+ #: includes/class-wc-stripe-webhook-handler.php:606
1332
  #. translators: 1) amount (including currency symbol) 2) transaction id 3)
1333
  #. refund message
1334
  msgid "Refunded %1$s - Refund ID: %2$s - %3$s"
1335
  msgstr ""
1336
 
1337
+ #: includes/class-wc-stripe-webhook-handler.php:637
1338
  #. translators: 1) The URL to the order. 2) The reason type.
1339
  msgid ""
1340
  "A review has been opened for this order. Action is needed. Please go to "
1342
  "Dashboard</a> to review the issue. Reason: (%2$s)"
1343
  msgstr ""
1344
 
1345
+ #: includes/class-wc-stripe-webhook-handler.php:670
1346
  #. translators: 1) The reason type.
1347
  msgid "The opened review for this order is now closed. Reason: (%s)"
1348
  msgstr ""
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WooCommerce Stripe Payment Gateway ===
2
  Contributors: woocommerce, automattic, royho, akeda, mattyza, bor0, woothemes
3
  Tags: credit card, stripe, apple pay, payment request, google pay, sepa, sofort, bancontact, alipay, giropay, ideal, p24, woocommerce, automattic
4
- Requires at least: 4.4
5
  Tested up to: 5.7
6
  Requires PHP: 5.6
7
- Stable tag: 5.3.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
@@ -126,8 +126,10 @@ If you get stuck, you can ask for help in the Plugin Forum.
126
 
127
  == Changelog ==
128
 
129
- = 5.3.0 - 2021-07-21 =
130
- * Fix - Disable Payment Request Buttons when order has to be split into multiple packages because Payment Requests do not support that use case.
131
- * Tweak - Payment request button should guide users to login when necessary.
 
 
132
 
133
  [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
1
  === WooCommerce Stripe Payment Gateway ===
2
  Contributors: woocommerce, automattic, royho, akeda, mattyza, bor0, woothemes
3
  Tags: credit card, stripe, apple pay, payment request, google pay, sepa, sofort, bancontact, alipay, giropay, ideal, p24, woocommerce, automattic
4
+ Requires at least: 4.6
5
  Tested up to: 5.7
6
  Requires PHP: 5.6
7
+ Stable tag: 5.4.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
126
 
127
  == Changelog ==
128
 
129
+ = 5.4.0 - 2021-08-18 =
130
+ * Fix - Do not ask for a Shipping Address if no Shipping Zone is defined.
131
+ * Fix - Return HTTP 204 when webhook validation fails so Stripe won't stop sending certain webhook events after too many failed validations.
132
+ * Fix - Possible use of an undefined variable `prepared_source`.
133
+ * Add - 'wc_stripe_allowed_payment_processing_statuses' filter to customize order statuses that allow payment processing in the context of 3DS payments.
134
 
135
  [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
woocommerce-gateway-stripe.php CHANGED
@@ -5,10 +5,10 @@
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
- * Version: 5.3.0
9
- * Requires at least: 4.4
10
  * Tested up to: 5.7
11
- * WC requires at least: 3.0
12
  * WC tested up to: 5.4
13
  * Text Domain: woocommerce-gateway-stripe
14
  * Domain Path: /languages
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  /**
22
  * Required minimums and constants
23
  */
24
- define( 'WC_STRIPE_VERSION', '5.3.0' ); // WRCS: DEFINED_VERSION.
25
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
26
  define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
27
  define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.3' );
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
+ * Version: 5.4.0
9
+ * Requires at least: 4.6
10
  * Tested up to: 5.7
11
+ * WC requires at least: 3.3
12
  * WC tested up to: 5.4
13
  * Text Domain: woocommerce-gateway-stripe
14
  * Domain Path: /languages
21
  /**
22
  * Required minimums and constants
23
  */
24
+ define( 'WC_STRIPE_VERSION', '5.4.0' ); // WRCS: DEFINED_VERSION.
25
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
26
  define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
27
  define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.3' );