WooCommerce Stripe Payment Gateway - Version 4.0.3

Version Description

  • 2018-01-18 =
  • Fix - Pass Stripe source as id instead of object as some sites may conflict with objects being passed.
  • Fix - For Payment Request Button, if test keys are not filled, it can cause live mode not to function.

See changelog for all versions.

=

Download this release

Release Info

Developer royho
Plugin Icon 128x128 WooCommerce Stripe Payment Gateway
Version 4.0.3
Comparing to
See all releases

Code changes from version 4.0.2 to 4.0.3

assets/js/stripe-payment-request.js CHANGED
@@ -116,7 +116,7 @@ jQuery( function( $ ) {
116
  payment_method: 'stripe',
117
  ship_to_different_address: 1,
118
  terms: 1,
119
- stripe_source: JSON.stringify( source ),
120
  payment_request_type: paymentRequestType
121
  };
122
 
116
  payment_method: 'stripe',
117
  ship_to_different_address: 1,
118
  terms: 1,
119
+ stripe_source: source.id,
120
  payment_request_type: paymentRequestType
121
  };
122
 
assets/js/stripe-payment-request.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){"use strict";var b=Stripe(wc_stripe_payment_request_params.stripe.key),c={getAjaxURL:function(a){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+a)},getCartDetails:function(b){var d={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:d,url:c.getAjaxURL("get_cart_details"),success:function(a){b.update({total:a.order_data.total})}})},getAttributes:function(){var b=a(".variations_form").find(".variations select"),c={},d=0,e=0;return b.each(function(){var b=a(this).data("attribute_name")||a(this).attr("name"),f=a(this).val()||"";f.length>0&&e++,d++,c[b]=f}),{count:d,chosenCount:e,data:c}},processSource:function(b,d){var e=c.getOrderData(b,d);return a.ajax({type:"POST",data:e,dataType:"json",url:c.getAjaxURL("create_order")})},getOrderData:function(a,b){var c=a.source,d=c.owner.email,e=c.owner.phone,f=c.owner.address,g=c.owner.name,h=a.shippingAddress,i={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==g?g.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==g?g.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==d?d:a.payerEmail,billing_phone:null!==e?e:a.payerPhone.replace("/[() -]/g",""),billing_country:null!==f?f.country:"",billing_address_1:null!==f?f.line1:"",billing_address_2:null!==f?f.line2:"",billing_city:null!==f?f.city:"",billing_state:null!==f?f.state:"",billing_postcode:null!==f?f.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===a.shippingOption?null:a.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:JSON.stringify(c),payment_request_type:b};return h&&(i.shipping_first_name=h.recipient.split(" ").slice(0,1).join(" "),i.shipping_last_name=h.recipient.split(" ").slice(1).join(" "),i.shipping_company=h.organization,i.shipping_country=h.country,i.shipping_address_1=void 0===h.addressLine[0]?"":h.addressLine[0],i.shipping_address_2=void 0===h.addressLine[1]?"":h.addressLine[1],i.shipping_city=h.city,i.shipping_state=h.region,i.shipping_postcode=h.postalCode),i},getErrorMessageHTML:function(b){return a('<div class="woocommerce-error" />').text(b)},abortPayment:function(b,c){if(b.complete("fail"),a(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var d=a(".product");d.before(c),a("html, body").animate({scrollTop:d.prev(".woocommerce-error").offset().top},600)}else{var e=a(".shop_table.cart").closest("form");e.before(c),a("html, body").animate({scrollTop:e.prev(".woocommerce-error").offset().top},600)}},completePayment:function(a,b){c.block(),a.complete("success"),window.location=b},block:function(){a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(b,d){var e={security:wc_stripe_payment_request_params.nonce.shipping,country:d.country,state:d.region,postcode:d.postalCode,city:d.city,address:void 0===d.addressLine[0]?"":d.addressLine[0],address_2:void 0===d.addressLine[1]?"":d.addressLine[1]};return a.ajax({type:"POST",data:e,url:c.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(b,d){var e={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[d.id]};return a.ajax({type:"POST",data:e,url:c.getAjaxURL("update_shipping_method")})},addToCart:function(){var b=a(".single_add_to_cart_button").val();a(".single_variation_wrap").length&&(b=a(".single_variation_wrap").find('input[name="product_id"]').val());var d={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:b,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?c.getAttributes().data:[]};return a.ajax({type:"POST",data:d,url:c.getAjaxURL("add_to_cart")})},clearCart:function(){var b={security:wc_stripe_payment_request_params.nonce.clear_cart};return a.ajax({type:"POST",data:b,url:c.getAjaxURL("clear_cart"),success:function(a){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(d){var e,f;wc_stripe_payment_request_params.is_product_page?(f=c.getRequestOptionsFromLocal(),e=f):(f={total:d.order_data.total,currency:d.order_data.currency,country:d.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:!!d.shipping_required,displayItems:d.order_data.displayItems},e=d.order_data);var g=b.paymentRequest(f),h="",i=b.elements({locale:wc_stripe_payment_request_params.button.locale}),j=i.create("paymentRequestButton",{paymentRequest:g,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}});g.canMakePayment().then(function(b){if(b){if(h=b.applePay?"apple_pay":"payment_request_api",wc_stripe_payment_request_params.is_product_page){var d=a(".single_add_to_cart_button");j.on("click",function(a){d.is(".disabled")?(a.preventDefault(),d.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):d.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)):c.addToCart()}),a(document.body).on("woocommerce_variation_has_changed",function(){a("#wc-stripe-payment-request-button").block({message:null}),a.when(c.getSelectedProductData()).then(function(b){a.when(g.update({total:b.total,displayItems:b.displayItems})).then(function(){a("#wc-stripe-payment-request-button").unblock()})})}),a(".quantity").on("change",".qty",function(){a("#wc-stripe-payment-request-button").block({message:null}),a.when(c.getSelectedProductData()).then(function(b){a.when(g.update({total:b.total,displayItems:b.displayItems})).then(function(){a("#wc-stripe-payment-request-button").unblock()})})})}a("#wc-stripe-payment-request-button").length&&(j.mount("#wc-stripe-payment-request-button"),a("#wc-stripe-payment-request-button-separator").show())}else a("#wc-stripe-payment-request-button").hide(),a("#wc-stripe-payment-request-button-separator").hide()}),g.on("shippingaddresschange",function(b){a.when(c.updateShippingOptions(e,b.shippingAddress)).then(function(a){b.updateWith({status:a.result,shippingOptions:a.shipping_options,total:a.total,displayItems:a.displayItems})})}),g.on("shippingoptionchange",function(b){a.when(c.updateShippingDetails(e,b.shippingOption)).then(function(a){"success"===a.result&&b.updateWith({status:"success",total:a.total,displayItems:a.displayItems}),"fail"===a.result&&b.updateWith({status:"fail"})})}),g.on("source",function(b){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===b.source.card.funding?c.abortPayment(b,c.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):a.when(c.processSource(b,h)).then(function(a){"success"===a.result?c.completePayment(b,a.redirect):c.abortPayment(b,a.messages)})})},getSelectedProductData:function(){var b=a(".single_add_to_cart_button").val();a(".single_variation_wrap").length&&(b=a(".single_variation_wrap").find('input[name="product_id"]').val());var d={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:b,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?c.getAttributes().data:[]};return a.ajax({type:"POST",data:d,url:c.getAjaxURL("get_selected_product_data")})},init:function(){var b={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:b,url:c.getAjaxURL("get_cart_details"),success:function(a){c.startPaymentRequest(a)}})}};c.init(),a(document.body).on("updated_cart_totals",function(){c.init()}),a(document.body).on("updated_checkout",function(){c.init()})});
1
+ jQuery(function(a){"use strict";var b=Stripe(wc_stripe_payment_request_params.stripe.key),c={getAjaxURL:function(a){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+a)},getCartDetails:function(b){var d={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:d,url:c.getAjaxURL("get_cart_details"),success:function(a){b.update({total:a.order_data.total})}})},getAttributes:function(){var b=a(".variations_form").find(".variations select"),c={},d=0,e=0;return b.each(function(){var b=a(this).data("attribute_name")||a(this).attr("name"),f=a(this).val()||"";f.length>0&&e++,d++,c[b]=f}),{count:d,chosenCount:e,data:c}},processSource:function(b,d){var e=c.getOrderData(b,d);return a.ajax({type:"POST",data:e,dataType:"json",url:c.getAjaxURL("create_order")})},getOrderData:function(a,b){var c=a.source,d=c.owner.email,e=c.owner.phone,f=c.owner.address,g=c.owner.name,h=a.shippingAddress,i={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==g?g.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==g?g.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==d?d:a.payerEmail,billing_phone:null!==e?e:a.payerPhone.replace("/[() -]/g",""),billing_country:null!==f?f.country:"",billing_address_1:null!==f?f.line1:"",billing_address_2:null!==f?f.line2:"",billing_city:null!==f?f.city:"",billing_state:null!==f?f.state:"",billing_postcode:null!==f?f.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===a.shippingOption?null:a.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:c.id,payment_request_type:b};return h&&(i.shipping_first_name=h.recipient.split(" ").slice(0,1).join(" "),i.shipping_last_name=h.recipient.split(" ").slice(1).join(" "),i.shipping_company=h.organization,i.shipping_country=h.country,i.shipping_address_1=void 0===h.addressLine[0]?"":h.addressLine[0],i.shipping_address_2=void 0===h.addressLine[1]?"":h.addressLine[1],i.shipping_city=h.city,i.shipping_state=h.region,i.shipping_postcode=h.postalCode),i},getErrorMessageHTML:function(b){return a('<div class="woocommerce-error" />').text(b)},abortPayment:function(b,c){if(b.complete("fail"),a(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var d=a(".product");d.before(c),a("html, body").animate({scrollTop:d.prev(".woocommerce-error").offset().top},600)}else{var e=a(".shop_table.cart").closest("form");e.before(c),a("html, body").animate({scrollTop:e.prev(".woocommerce-error").offset().top},600)}},completePayment:function(a,b){c.block(),a.complete("success"),window.location=b},block:function(){a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(b,d){var e={security:wc_stripe_payment_request_params.nonce.shipping,country:d.country,state:d.region,postcode:d.postalCode,city:d.city,address:void 0===d.addressLine[0]?"":d.addressLine[0],address_2:void 0===d.addressLine[1]?"":d.addressLine[1]};return a.ajax({type:"POST",data:e,url:c.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(b,d){var e={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[d.id]};return a.ajax({type:"POST",data:e,url:c.getAjaxURL("update_shipping_method")})},addToCart:function(){var b=a(".single_add_to_cart_button").val();a(".single_variation_wrap").length&&(b=a(".single_variation_wrap").find('input[name="product_id"]').val());var d={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:b,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?c.getAttributes().data:[]};return a.ajax({type:"POST",data:d,url:c.getAjaxURL("add_to_cart")})},clearCart:function(){var b={security:wc_stripe_payment_request_params.nonce.clear_cart};return a.ajax({type:"POST",data:b,url:c.getAjaxURL("clear_cart"),success:function(a){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(d){var e,f;wc_stripe_payment_request_params.is_product_page?(f=c.getRequestOptionsFromLocal(),e=f):(f={total:d.order_data.total,currency:d.order_data.currency,country:d.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:!!d.shipping_required,displayItems:d.order_data.displayItems},e=d.order_data);var g=b.paymentRequest(f),h="",i=b.elements({locale:wc_stripe_payment_request_params.button.locale}),j=i.create("paymentRequestButton",{paymentRequest:g,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}});g.canMakePayment().then(function(b){if(b){if(h=b.applePay?"apple_pay":"payment_request_api",wc_stripe_payment_request_params.is_product_page){var d=a(".single_add_to_cart_button");j.on("click",function(a){d.is(".disabled")?(a.preventDefault(),d.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):d.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)):c.addToCart()}),a(document.body).on("woocommerce_variation_has_changed",function(){a("#wc-stripe-payment-request-button").block({message:null}),a.when(c.getSelectedProductData()).then(function(b){a.when(g.update({total:b.total,displayItems:b.displayItems})).then(function(){a("#wc-stripe-payment-request-button").unblock()})})}),a(".quantity").on("change",".qty",function(){a("#wc-stripe-payment-request-button").block({message:null}),a.when(c.getSelectedProductData()).then(function(b){a.when(g.update({total:b.total,displayItems:b.displayItems})).then(function(){a("#wc-stripe-payment-request-button").unblock()})})})}a("#wc-stripe-payment-request-button").length&&(j.mount("#wc-stripe-payment-request-button"),a("#wc-stripe-payment-request-button-separator").show())}else a("#wc-stripe-payment-request-button").hide(),a("#wc-stripe-payment-request-button-separator").hide()}),g.on("shippingaddresschange",function(b){a.when(c.updateShippingOptions(e,b.shippingAddress)).then(function(a){b.updateWith({status:a.result,shippingOptions:a.shipping_options,total:a.total,displayItems:a.displayItems})})}),g.on("shippingoptionchange",function(b){a.when(c.updateShippingDetails(e,b.shippingOption)).then(function(a){"success"===a.result&&b.updateWith({status:"success",total:a.total,displayItems:a.displayItems}),"fail"===a.result&&b.updateWith({status:"fail"})})}),g.on("source",function(b){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===b.source.card.funding?c.abortPayment(b,c.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):a.when(c.processSource(b,h)).then(function(a){"success"===a.result?c.completePayment(b,a.redirect):c.abortPayment(b,a.messages)})})},getSelectedProductData:function(){var b=a(".single_add_to_cart_button").val();a(".single_variation_wrap").length&&(b=a(".single_variation_wrap").find('input[name="product_id"]').val());var d={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:b,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?c.getAttributes().data:[]};return a.ajax({type:"POST",data:d,url:c.getAjaxURL("get_selected_product_data")})},init:function(){var b={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:b,url:c.getAjaxURL("get_cart_details"),success:function(a){c.startPaymentRequest(a)}})}};c.init(),a(document.body).on("updated_cart_totals",function(){c.init()}),a(document.body).on("updated_checkout",function(){c.init()})});
assets/js/stripe.js CHANGED
@@ -190,7 +190,7 @@ jQuery( function( $ ) {
190
 
191
  // Check to see if Stripe in general is being used for checkout.
192
  isStripeChosen: function() {
193
- return $( '#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_bitcoin' ).is( ':checked' ) || 'new' === $( 'input[name="wc-stripe-payment-token"]:checked' ).val();
194
  },
195
 
196
  // Currently only support saved cards via credit cards and SEPA. No other payment method.
@@ -513,7 +513,11 @@ jQuery( function( $ ) {
513
  } else if ( 'no' === wc_stripe_params.allow_prepaid_card && 'card' === response.source.type && 'prepaid' === response.source.card.funding ) {
514
  response.error = { message: wc_stripe_params.no_prepaid_card_msg };
515
 
516
- $( document.body ).trigger( 'stripeError', response );
 
 
 
 
517
  } else {
518
  wc_stripe_form.processStripeResponse( response.source );
519
  }
@@ -712,7 +716,7 @@ jQuery( function( $ ) {
712
  wc_stripe_form.reset();
713
 
714
  // Insert the Source into the form so it gets submitted to the server.
715
- wc_stripe_form.form.append( "<input type='hidden' class='stripe-source' name='stripe_source' value='" + JSON.stringify( wc_stripe_form.prepareSourceToServer( source ) ) + "'/>" );
716
 
717
  if ( $( 'form#add_payment_method' ).length ) {
718
  $( wc_stripe_form.form ).off( 'submit', wc_stripe_form.form.onSubmit );
@@ -788,9 +792,27 @@ jQuery( function( $ ) {
788
  wc_stripe_form.form.prepend( '<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">' + error_message + '</div>' );
789
  wc_stripe_form.form.removeClass( 'processing' ).unblock();
790
  wc_stripe_form.form.find( '.input-text, select, input:checkbox' ).blur();
791
- $( 'html, body' ).animate({
792
- scrollTop: ( $( 'form.checkout' ).offset().top - 100 )
793
- }, 500 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
794
  $( document.body ).trigger( 'checkout_error' );
795
  wc_stripe_form.unblock();
796
  }
190
 
191
  // Check to see if Stripe in general is being used for checkout.
192
  isStripeChosen: function() {
193
+ return $( '#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_bitcoin' ).is( ':checked' ) || ( $( '#payment_method_stripe' ).is( ':checked' ) && 'new' === $( 'input[name="wc-stripe-payment-token"]:checked' ).val() ) || ( $( '#payment_method_stripe_sepa' ).is( ':checked' ) && 'new' === $( 'input[name="wc-stripe-payment-token"]:checked' ).val() );
194
  },
195
 
196
  // Currently only support saved cards via credit cards and SEPA. No other payment method.
513
  } else if ( 'no' === wc_stripe_params.allow_prepaid_card && 'card' === response.source.type && 'prepaid' === response.source.card.funding ) {
514
  response.error = { message: wc_stripe_params.no_prepaid_card_msg };
515
 
516
+ if ( wc_stripe_params.is_stripe_checkout ) {
517
+ wc_stripe_form.submitError( '<ul class="woocommerce-error"><li>' + wc_stripe_params.no_prepaid_card_msg + '</li></ul>' );
518
+ } else {
519
+ $( document.body ).trigger( 'stripeError', response );
520
+ }
521
  } else {
522
  wc_stripe_form.processStripeResponse( response.source );
523
  }
716
  wc_stripe_form.reset();
717
 
718
  // Insert the Source into the form so it gets submitted to the server.
719
+ wc_stripe_form.form.append( "<input type='hidden' class='stripe-source' name='stripe_source' value='" + source.id + "'/>" );
720
 
721
  if ( $( 'form#add_payment_method' ).length ) {
722
  $( wc_stripe_form.form ).off( 'submit', wc_stripe_form.form.onSubmit );
792
  wc_stripe_form.form.prepend( '<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">' + error_message + '</div>' );
793
  wc_stripe_form.form.removeClass( 'processing' ).unblock();
794
  wc_stripe_form.form.find( '.input-text, select, input:checkbox' ).blur();
795
+
796
+ var selector = '';
797
+
798
+ if ( $( '#add_payment_method' ).length ) {
799
+ selector = $( '#add_payment_method' );
800
+ }
801
+
802
+ if ( $( '#order_review' ).length ) {
803
+ selector = $( '#order_review' );
804
+ }
805
+
806
+ if ( $( 'form.checkout' ).length ) {
807
+ selector = $( 'form.checkout' );
808
+ }
809
+
810
+ if ( selector.length ) {
811
+ $( 'html, body' ).animate({
812
+ scrollTop: ( selector.offset().top - 100 )
813
+ }, 500 );
814
+ }
815
+
816
  $( document.body ).trigger( 'checkout_error' );
817
  wc_stripe_form.unblock();
818
  }
assets/js/stripe.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){"use strict";var b=Stripe(wc_stripe_params.key);if("yes"===wc_stripe_params.use_elements)var c,d,e,f=b.elements();var g={getAjaxURL:function(a){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+a)},init:function(){"yes"===wc_stripe_params.is_change_payment_page&&a(document.body).trigger("wc-credit-card-form-init"),this.stripe_checkout_submit=!1,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 checkout_place_order_stripe_bitcoin",this.onSubmit),a("form#order_review").length&&(this.form=a("form#order_review")),a("form#order_review").on("submit",this.onSubmit),a("form#add_payment_method").length&&(this.form=a("form#add_payment_method")),a("form#add_payment_method").on("submit",this.onSubmit),a("form.woocommerce-checkout").on("change","#stripe-bank-country",this.reset),a(document).on("stripeError",this.onError).on("checkout_error",this.reset);var b={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},h={focus:"focused",empty:"empty",invalid:"invalid"};"yes"===wc_stripe_params.use_elements&&a("#stripe-card-element").length&&(b=wc_stripe_params.elements_styling?wc_stripe_params.elements_styling:b,h=wc_stripe_params.elements_classes?wc_stripe_params.elements_classes:h,"yes"===wc_stripe_params.inline_cc_form?(c=f.create("card",{style:b,hidePostalCode:!0}),c.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})):(c=f.create("cardNumber",{style:b,classes:h}),d=f.create("cardExpiry",{style:b,classes:h}),e=f.create("cardCvc",{style:b,classes:h}),c.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),d.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),e.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})),wc_stripe_params.is_checkout?a(document.body).on("updated_checkout",function(){c&&("yes"===wc_stripe_params.inline_cc_form?c.unmount("#stripe-card-element"):(c.unmount("#stripe-card-element"),d.unmount("#stripe-exp-element"),e.unmount("#stripe-cvc-element"))),"yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))}):(a("form#add_payment_method").length||a("form#order_review").length)&&("yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))))},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_bitcoin").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")},isBitcoinChosen:function(){return a("#payment_method_stripe_bitcoin").is(":checked")},hasSource:function(){return 0<a("input.stripe-source").length},hasToken:function(){return 0<a("input.stripe_token").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},isStripeModalNeeded:function(a){var b=g.form.find("input.stripe_token");return(!g.stripe_submit||!b)&&!!g.isStripeChosen()},block:function(){g.isMobile()?a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}}):g.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){g.isMobile()?a.unblockUI():g.form.unblock()},getSelectedPaymentElement:function(){return a('.payment_methods input[name="payment_method"]:checked')},openModal:function(){var c=g.form,d=a("#stripe-payment-data");g.reset();var e=function(a){if(c.find("input.stripe_source").remove(),"token"===a.object)b.createSource({type:"card",token:a.id}).then(g.sourceResponse);else if("source"===a.object){var d={source:a};g.sourceResponse(d)}};StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address,amount:d.data("amount"),name:d.data("name"),description:d.data("description"),currency:d.data("currency"),image:d.data("image"),bitcoin:d.data("bitcoin"),locale:d.data("locale"),email:a("#billing_email").val()||d.data("email"),panelLabel:d.data("panel-label"),allowRememberMe:d.data("allow-remember-me"),token:e,closed:g.onClose()})},resetModal:function(){g.reset(),g.stripe_checkout_submit=!1},onClose:function(){g.unblock()},onError:function(b,c){var d=c.error.message,e=g.getSelectedPaymentElement().parent(".wc_payment_method, .woocommerce-PaymentMethod").find(".stripe-source-errors");"invalid_request_error"!==c.error.type&&"api_connection_error"!==c.error.type&&"api_error"!==c.error.type&&"authentication_error"!==c.error.type&&"rate_limit_error"!==c.error.type||(d=wc_stripe_params.invalid_request_error),"card_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),"validation_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),g.reset(),a(".woocommerce-NoticeGroup-checkout").remove(),console.log(c.error.message),a(e).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li>'+d+"</li></ul>"),a("html, body").animate({scrollTop:a(".wc-stripe-error").offset().top-200},200),g.unblock()},getOwnerDetails:function(){var b=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,c=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,d={owner:{name:"",address:{},email:"",phone:""}};return d.owner.name=b,b&&c&&(d.owner.name=b+" "+c),d.owner.email=a("#billing_email").val(),d.owner.phone=a("#billing_phone").val(),void 0!==d.owner.phone&&0>=d.owner.phone.length&&delete d.owner.phone,void 0!==d.owner.email&&0>=d.owner.email.length&&delete d.owner.email,a("#billing_address_1").length>0?(d.owner.address.line1=a("#billing_address_1").val(),d.owner.address.line2=a("#billing_address_2").val(),d.owner.address.state=a("#billing_state").val(),d.owner.address.city=a("#billing_city").val(),d.owner.address.postal_code=a("#billing_postcode").val(),d.owner.address.country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(d.owner.address.line1=wc_stripe_params.billing_address_1,d.owner.address.line2=wc_stripe_params.billing_address_2,d.owner.address.state=wc_stripe_params.billing_state,d.owner.address.city=wc_stripe_params.billing_city,d.owner.address.postal_code=wc_stripe_params.billing_postcode,d.owner.address.country=wc_stripe_params.billing_country),d},createSource:function(){var d=g.getOwnerDetails(),e="card";if(g.isBancontactChosen()&&(e="bancontact"),g.isSepaChosen()&&(e="sepa_debit"),g.isIdealChosen()&&(e="ideal"),g.isSofortChosen()&&(e="sofort"),g.isBitcoinChosen()&&(e="bitcoin"),g.isGiropayChosen()&&(e="giropay"),g.isAlipayChosen()&&(e="alipay"),"card"===e)b.createSource(c,d).then(g.sourceResponse);else{switch(e){case"bancontact":case"giropay":case"ideal":case"sofort":case"alipay":d.amount=a("#stripe-"+e+"-payment-data").data("amount"),d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.redirect={return_url:wc_stripe_params.return_url},wc_stripe_params.statement_descriptor&&(d.statement_descriptor=wc_stripe_params.statement_descriptor)}switch(e){case"sepa_debit":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.owner.name=a("#stripe-sepa-owner").val(),d.sepa_debit={iban:a("#stripe-sepa-iban").val()};break;case"ideal":d.ideal={bank:a("#stripe-ideal-bank").val()};break;case"bitcoin":case"alipay":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.amount=a("#stripe-"+e+"-payment-data").data("amount")}d.type=e,b.createSource(d).then(g.sourceResponse)}},sourceResponse:function(b){b.error?a(document.body).trigger("stripeError",b):"no"===wc_stripe_params.allow_prepaid_card&&"card"===b.source.type&&"prepaid"===b.source.card.funding?(b.error={message:wc_stripe_params.no_prepaid_card_msg},a(document.body).trigger("stripeError",b)):g.processStripeResponse(b.source)},createToken:function(){var b=a("#stripe-card-number").val(),c=a("#stripe-card-cvc").val(),d=a("#stripe-card-expiry").payment("cardExpiryVal"),e=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,f=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,h={number:b,cvc:c,exp_month:parseInt(d.month,10)||0,exp_year:parseInt(d.year,10)||0};e&&f&&(h.name=e+" "+f),a("#billing_address_1").length>0?(h.address_line1=a("#billing_address_1").val(),h.address_line2=a("#billing_address_2").val(),h.address_state=a("#billing_state").val(),h.address_city=a("#billing_city").val(),h.address_zip=a("#billing_postcode").val(),h.address_country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(h.address_line1=wc_stripe_params.billing_address_1,h.address_line2=wc_stripe_params.billing_address_2,h.address_state=wc_stripe_params.billing_state,h.address_city=wc_stripe_params.billing_city,h.address_zip=wc_stripe_params.billing_postcode,h.address_country=wc_stripe_params.billing_country),Stripe.setPublishableKey(wc_stripe_params.key),Stripe.createToken(h,g.onStripeTokenResponse)},onStripeTokenResponse:function(b,c){if(c.error)a(document).trigger("stripeError",c);else{if("no"===wc_stripe_params.allow_prepaid_card&&"prepaid"===c.card.funding)return c.error={message:wc_stripe_params.no_prepaid_card_msg},a(document).trigger("stripeError",{response:c}),!1;var d=c.id;g.form.append("<input type='hidden' class='stripe_token' name='stripe_token' value='"+d+"'/>"),a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),g.form.submit()}},onSubmit:function(b){if(g.isStripeChosen()&&!g.isStripeSaveCardChosen()&&!g.hasSource()&&!g.hasToken()){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&g.isStripeModalNeeded()&&g.isStripeCardChosen())return g.isMobile()?g.openModal():g.validateCheckout("modal"),!1;if(g.block(),g.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements)return g.createToken(),!1;if(g.isBancontactChosen()||g.isGiropayChosen()||g.isIdealChosen()||g.isAlipayChosen())return a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),g.form.submit()),!0;if(g.isSofortChosen()){if("-1"===a("#stripe-bank-country").val()){var c={error:{message:wc_stripe_params.no_bank_country_msg}};return a(document.body).trigger("stripeError",c),!1}return a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),g.form.submit()),!0}return g.validateCheckout(),!1}if(a("form#add_payment_method").length){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&g.isStripeModalNeeded()&&g.isStripeCardChosen())return g.openModal(),!1;if(g.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}return g.block(),g.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements?(g.createToken(),!1):(g.createSource(),!1)}},onCCFormChange:function(){g.reset()},prepareSourceToServer:function(a){return{id:a.id,card:a.card?a.card:"",bitcoin:a.bitcoin?a.bitcoin:"",flow:a.flow,object:a.object,status:a.status,type:a.type,usage:a.usage}},processStripeResponse:function(b){g.reset(),g.form.append("<input type='hidden' class='stripe-source' name='stripe_source' value='"+JSON.stringify(g.prepareSourceToServer(b))+"'/>"),a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),g.form.submit()},reset:function(){a(".wc-stripe-error, .stripe-source, .stripe_token, .stripe-checkout-object").remove(),"yes"===wc_stripe_params.is_stripe_checkout&&(g.stripe_submit=!1)},getRequiredFields:function(){return g.form.find(".form-row.validate-required > input, .form-row.validate-required > select, .form-row.validate-required > textarea")},validateCheckout:function(b){void 0===b&&(b="");var c={nonce:wc_stripe_params.stripe_nonce,required_fields:g.getRequiredFields().serialize(),all_fields:g.form.serialize(),source_type:g.getSelectedPaymentElement().val(),is_add_payment_page:wc_stripe_params.is_add_payment_method_page};a.ajax({type:"POST",url:g.getAjaxURL("validate_checkout"),data:c,dataType:"json",success:function(c){if("success"===c)if("modal"===b)g.openModal();else{if(g.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}g.createSource()}else c.messages&&(g.resetModal(),g.reset(),g.submitError(c.messages))}})},submitError:function(b){a(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),g.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+b+"</div>"),g.form.removeClass("processing").unblock(),g.form.find(".input-text, select, input:checkbox").blur(),a("html, body").animate({scrollTop:a("form.checkout").offset().top-100},500),a(document.body).trigger("checkout_error"),g.unblock()}};g.init()});
1
+ jQuery(function(a){"use strict";var b=Stripe(wc_stripe_params.key);if("yes"===wc_stripe_params.use_elements)var c,d,e,f=b.elements();var g={getAjaxURL:function(a){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+a)},init:function(){"yes"===wc_stripe_params.is_change_payment_page&&a(document.body).trigger("wc-credit-card-form-init"),this.stripe_checkout_submit=!1,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 checkout_place_order_stripe_bitcoin",this.onSubmit),a("form#order_review").length&&(this.form=a("form#order_review")),a("form#order_review").on("submit",this.onSubmit),a("form#add_payment_method").length&&(this.form=a("form#add_payment_method")),a("form#add_payment_method").on("submit",this.onSubmit),a("form.woocommerce-checkout").on("change","#stripe-bank-country",this.reset),a(document).on("stripeError",this.onError).on("checkout_error",this.reset);var b={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},h={focus:"focused",empty:"empty",invalid:"invalid"};"yes"===wc_stripe_params.use_elements&&a("#stripe-card-element").length&&(b=wc_stripe_params.elements_styling?wc_stripe_params.elements_styling:b,h=wc_stripe_params.elements_classes?wc_stripe_params.elements_classes:h,"yes"===wc_stripe_params.inline_cc_form?(c=f.create("card",{style:b,hidePostalCode:!0}),c.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})):(c=f.create("cardNumber",{style:b,classes:h}),d=f.create("cardExpiry",{style:b,classes:h}),e=f.create("cardCvc",{style:b,classes:h}),c.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),d.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),e.addEventListener("change",function(b){g.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})),wc_stripe_params.is_checkout?a(document.body).on("updated_checkout",function(){c&&("yes"===wc_stripe_params.inline_cc_form?c.unmount("#stripe-card-element"):(c.unmount("#stripe-card-element"),d.unmount("#stripe-exp-element"),e.unmount("#stripe-cvc-element"))),"yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))}):(a("form#add_payment_method").length||a("form#order_review").length)&&("yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))))},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_bitcoin").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")},isBitcoinChosen:function(){return a("#payment_method_stripe_bitcoin").is(":checked")},hasSource:function(){return 0<a("input.stripe-source").length},hasToken:function(){return 0<a("input.stripe_token").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},isStripeModalNeeded:function(a){var b=g.form.find("input.stripe_token");return(!g.stripe_submit||!b)&&!!g.isStripeChosen()},block:function(){g.isMobile()?a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}}):g.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){g.isMobile()?a.unblockUI():g.form.unblock()},getSelectedPaymentElement:function(){return a('.payment_methods input[name="payment_method"]:checked')},openModal:function(){var c=g.form,d=a("#stripe-payment-data");g.reset();var e=function(a){if(c.find("input.stripe_source").remove(),"token"===a.object)b.createSource({type:"card",token:a.id}).then(g.sourceResponse);else if("source"===a.object){var d={source:a};g.sourceResponse(d)}};StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address,amount:d.data("amount"),name:d.data("name"),description:d.data("description"),currency:d.data("currency"),image:d.data("image"),bitcoin:d.data("bitcoin"),locale:d.data("locale"),email:a("#billing_email").val()||d.data("email"),panelLabel:d.data("panel-label"),allowRememberMe:d.data("allow-remember-me"),token:e,closed:g.onClose()})},resetModal:function(){g.reset(),g.stripe_checkout_submit=!1},onClose:function(){g.unblock()},onError:function(b,c){var d=c.error.message,e=g.getSelectedPaymentElement().parent(".wc_payment_method, .woocommerce-PaymentMethod").find(".stripe-source-errors");"invalid_request_error"!==c.error.type&&"api_connection_error"!==c.error.type&&"api_error"!==c.error.type&&"authentication_error"!==c.error.type&&"rate_limit_error"!==c.error.type||(d=wc_stripe_params.invalid_request_error),"card_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),"validation_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),g.reset(),a(".woocommerce-NoticeGroup-checkout").remove(),console.log(c.error.message),a(e).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li>'+d+"</li></ul>"),a("html, body").animate({scrollTop:a(".wc-stripe-error").offset().top-200},200),g.unblock()},getOwnerDetails:function(){var b=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,c=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,d={owner:{name:"",address:{},email:"",phone:""}};return d.owner.name=b,b&&c&&(d.owner.name=b+" "+c),d.owner.email=a("#billing_email").val(),d.owner.phone=a("#billing_phone").val(),void 0!==d.owner.phone&&0>=d.owner.phone.length&&delete d.owner.phone,void 0!==d.owner.email&&0>=d.owner.email.length&&delete d.owner.email,a("#billing_address_1").length>0?(d.owner.address.line1=a("#billing_address_1").val(),d.owner.address.line2=a("#billing_address_2").val(),d.owner.address.state=a("#billing_state").val(),d.owner.address.city=a("#billing_city").val(),d.owner.address.postal_code=a("#billing_postcode").val(),d.owner.address.country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(d.owner.address.line1=wc_stripe_params.billing_address_1,d.owner.address.line2=wc_stripe_params.billing_address_2,d.owner.address.state=wc_stripe_params.billing_state,d.owner.address.city=wc_stripe_params.billing_city,d.owner.address.postal_code=wc_stripe_params.billing_postcode,d.owner.address.country=wc_stripe_params.billing_country),d},createSource:function(){var d=g.getOwnerDetails(),e="card";if(g.isBancontactChosen()&&(e="bancontact"),g.isSepaChosen()&&(e="sepa_debit"),g.isIdealChosen()&&(e="ideal"),g.isSofortChosen()&&(e="sofort"),g.isBitcoinChosen()&&(e="bitcoin"),g.isGiropayChosen()&&(e="giropay"),g.isAlipayChosen()&&(e="alipay"),"card"===e)b.createSource(c,d).then(g.sourceResponse);else{switch(e){case"bancontact":case"giropay":case"ideal":case"sofort":case"alipay":d.amount=a("#stripe-"+e+"-payment-data").data("amount"),d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.redirect={return_url:wc_stripe_params.return_url},wc_stripe_params.statement_descriptor&&(d.statement_descriptor=wc_stripe_params.statement_descriptor)}switch(e){case"sepa_debit":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.owner.name=a("#stripe-sepa-owner").val(),d.sepa_debit={iban:a("#stripe-sepa-iban").val()};break;case"ideal":d.ideal={bank:a("#stripe-ideal-bank").val()};break;case"bitcoin":case"alipay":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.amount=a("#stripe-"+e+"-payment-data").data("amount")}d.type=e,b.createSource(d).then(g.sourceResponse)}},sourceResponse:function(b){b.error?a(document.body).trigger("stripeError",b):"no"===wc_stripe_params.allow_prepaid_card&&"card"===b.source.type&&"prepaid"===b.source.card.funding?(b.error={message:wc_stripe_params.no_prepaid_card_msg},wc_stripe_params.is_stripe_checkout?g.submitError('<ul class="woocommerce-error"><li>'+wc_stripe_params.no_prepaid_card_msg+"</li></ul>"):a(document.body).trigger("stripeError",b)):g.processStripeResponse(b.source)},createToken:function(){var b=a("#stripe-card-number").val(),c=a("#stripe-card-cvc").val(),d=a("#stripe-card-expiry").payment("cardExpiryVal"),e=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,f=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,h={number:b,cvc:c,exp_month:parseInt(d.month,10)||0,exp_year:parseInt(d.year,10)||0};e&&f&&(h.name=e+" "+f),a("#billing_address_1").length>0?(h.address_line1=a("#billing_address_1").val(),h.address_line2=a("#billing_address_2").val(),h.address_state=a("#billing_state").val(),h.address_city=a("#billing_city").val(),h.address_zip=a("#billing_postcode").val(),h.address_country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(h.address_line1=wc_stripe_params.billing_address_1,h.address_line2=wc_stripe_params.billing_address_2,h.address_state=wc_stripe_params.billing_state,h.address_city=wc_stripe_params.billing_city,h.address_zip=wc_stripe_params.billing_postcode,h.address_country=wc_stripe_params.billing_country),Stripe.setPublishableKey(wc_stripe_params.key),Stripe.createToken(h,g.onStripeTokenResponse)},onStripeTokenResponse:function(b,c){if(c.error)a(document).trigger("stripeError",c);else{if("no"===wc_stripe_params.allow_prepaid_card&&"prepaid"===c.card.funding)return c.error={message:wc_stripe_params.no_prepaid_card_msg},a(document).trigger("stripeError",{response:c}),!1;var d=c.id;g.form.append("<input type='hidden' class='stripe_token' name='stripe_token' value='"+d+"'/>"),a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),g.form.submit()}},onSubmit:function(b){if(g.isStripeChosen()&&!g.isStripeSaveCardChosen()&&!g.hasSource()&&!g.hasToken()){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&g.isStripeModalNeeded()&&g.isStripeCardChosen())return g.isMobile()?g.openModal():g.validateCheckout("modal"),!1;if(g.block(),g.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements)return g.createToken(),!1;if(g.isBancontactChosen()||g.isGiropayChosen()||g.isIdealChosen()||g.isAlipayChosen())return a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),g.form.submit()),!0;if(g.isSofortChosen()){if("-1"===a("#stripe-bank-country").val()){var c={error:{message:wc_stripe_params.no_bank_country_msg}};return a(document.body).trigger("stripeError",c),!1}return a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),g.form.submit()),!0}return g.validateCheckout(),!1}if(a("form#add_payment_method").length){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&g.isStripeModalNeeded()&&g.isStripeCardChosen())return g.openModal(),!1;if(g.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}return g.block(),g.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements?(g.createToken(),!1):(g.createSource(),!1)}},onCCFormChange:function(){g.reset()},prepareSourceToServer:function(a){return{id:a.id,card:a.card?a.card:"",bitcoin:a.bitcoin?a.bitcoin:"",flow:a.flow,object:a.object,status:a.status,type:a.type,usage:a.usage}},processStripeResponse:function(b){g.reset(),g.form.append("<input type='hidden' class='stripe-source' name='stripe_source' value='"+b.id+"'/>"),a("form#add_payment_method").length&&a(g.form).off("submit",g.form.onSubmit),g.form.submit()},reset:function(){a(".wc-stripe-error, .stripe-source, .stripe_token, .stripe-checkout-object").remove(),"yes"===wc_stripe_params.is_stripe_checkout&&(g.stripe_submit=!1)},getRequiredFields:function(){return g.form.find(".form-row.validate-required > input, .form-row.validate-required > select, .form-row.validate-required > textarea")},validateCheckout:function(b){void 0===b&&(b="");var c={nonce:wc_stripe_params.stripe_nonce,required_fields:g.getRequiredFields().serialize(),all_fields:g.form.serialize(),source_type:g.getSelectedPaymentElement().val(),is_add_payment_page:wc_stripe_params.is_add_payment_method_page};a.ajax({type:"POST",url:g.getAjaxURL("validate_checkout"),data:c,dataType:"json",success:function(c){if("success"===c)if("modal"===b)g.openModal();else{if(g.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}g.createSource()}else c.messages&&(g.resetModal(),g.reset(),g.submitError(c.messages))}})},submitError:function(b){a(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),g.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+b+"</div>"),g.form.removeClass("processing").unblock(),g.form.find(".input-text, select, input:checkbox").blur();var c="";a("#add_payment_method").length&&(c=a("#add_payment_method")),a("#order_review").length&&(c=a("#order_review")),a("form.checkout").length&&(c=a("form.checkout")),c.length&&a("html, body").animate({scrollTop:c.offset().top-100},500),a(document.body).trigger("checkout_error"),g.unblock()}};g.init()});
changelog.txt CHANGED
@@ -1,5 +1,27 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 4.0.2 - 2018-01-17 =
4
  * Add - 3DS support on Stripe Checkout ( Modal Popup ).
5
  * Add - Filter to enable Payment Request Button on Checkout 'wc_stripe_show_payment_request_on_checkout'.
@@ -36,72 +58,179 @@
36
  * Add - P24.
37
  * Add - Alipay.
38
 
39
- = 3.0.2 - 2016.06.14 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  * Fix - Set empty array as default value for first argument in WC_Stripe_Customer::create_customer
41
  * Tweak - Update default title to make it consistent with existing titles
42
 
43
- = 2.6.12 - 2016.04.13 =
 
 
 
 
 
 
 
 
 
44
  * Fix - When saved cards option is enabled with no cards on file, CC field was hidden.
45
 
46
- = 2.6.11 - 2016.04.11 =
47
  * Add - Option to set a default card in manage card section and detect previous card paid by subscription.
48
  * Fix - Admin notice link when key is not added and when addons are present.
49
 
50
- = 2.6.10 - 2016.03.16 =
51
  * Tweak - Add logging mechanism. New 'Logging' option is added in Stripe gateway setting to enable logging.
52
  * Fix - Allow language files to be located outside of plugin directory
53
 
54
- = 2.6.9 - 2016.02.29 =
55
  * Tweak - Allow mechanism to override Stripe JS error handler. See https://gist.github.com/gedex/240492f479c7443e4780
56
  for an example to override error handler with simple alert.
57
 
58
- = 2.6.8 - 2016.02.11 =
59
  * Tweak - Include card brand in saved cards radio label class
60
  * Tweak - Add action when deleting card
61
  * Tweak - Add actions for add_card and add_customer
62
  * Tweak - Add support for automatic localisation in Stripe Checkout modal
63
  * Fix - Check for Stripe error code emptiness before returning the WP_Error
64
 
65
- = 2.6.7 - 2015.12.17 =
66
  * Fix is_available SSL check to also work properly on hosts that always serve HTTPS
67
 
68
- = 2.6.6 - 2015.12.03 =
69
  * Fix a JavaScript bug introduced in 2.6.4 that caused checkout with a saved card to fail
70
 
71
- = 2.6.5 - 2015.12.02 =
72
  * Do not require a card id when updating a subscription payment method
73
 
74
- = 2.6.4 - 2015.11.20 =
75
  * Fix a JavaScript bug that caused the Stripe Checkout popup to be blocked on Chrome for iOS
76
 
77
- = 2.6.3 - 2015.11.12 =
78
  * Add metadata to subscription payments in stripe dashboard to indicate whether it is the initial or a recurring payment
79
 
80
- = 2.6.2 - 2015.11.06 =
81
  * Fix bug that would cause multiple subscriptions to not be supported under certain circumstances
82
 
83
- = 2.6.1 - 2015.09.15 =
84
  * Unset source if not set during pre-order release payments.
85
  * Store customer ID if not logged in for pre-order payments.
86
 
87
- = 2.6.0 - 2015.09.02 =
88
  * Subscriptions 2.0 support.
89
 
90
- = 2.5.4 - 2015.08.11 =
91
  * Tweak - Terms and conditions error styling when required
92
  * Tweak - Account password error styling when required
93
 
94
- = 2.5.3 - 2015.7.28 =
95
  * Added - Filter to prevent Stripe from sending its own receipts "wc_stripe_send_stripe_receipt"
96
 
97
- = 2.5.2 - 2015.07.19 =
98
  * Fix - Removed deprecated add_error function
99
  * Tweak - Improve error message when Stripe checkout function is used
100
 
101
- = 2.5.1 - 2015.07.01 =
102
  * Fix - Only send receipt_email when set.
103
 
104
- = 2.5.0 - 2015.05.11 =
105
  * Update to API version 2015-04-07
106
  * Feature - Support authorize on subscriptions first payment.
107
  * Tweak - Option labels.
@@ -110,21 +239,21 @@
110
  * Tweak - Update card icons.
111
  * Tweak - Pass receipt email.
112
 
113
- = 2.4.3 - 2015.05.11 =
114
  * Fix - fixed validation issue when account creation is not checked
115
  * Update - Stripe checkout JS API v2
116
 
117
- = 2.4.2 - 2015.03.23 =
118
  * Fix - Create account password field was not being validated
119
 
120
- = 2.4.1 - 2015.03.20 =
121
  * Fix - Undefined JS error due to deprecated ajax_loader_url
122
  * Fix - When using Stripe checkout JS, some form required fields were not validating
123
 
124
- = 2.4.0 - 2015.02.20 =
125
  * Added support for bitcoin currency
126
 
127
- = 2.3.0 - 2015.01.31 =
128
  * Added 'wc_stripe_description' filter to allow filtering of payment description.
129
  * Added order_review handling for stripe checkout.
130
  * Mark order as failed is Stripe API call fails
@@ -134,41 +263,41 @@
134
  * Fix fees where not logged correctly when using authorized first capture later
135
  * Retry payment if customer_id is invalid.
136
 
137
- = 2.2.8 - 2014.11.21 =
138
  * Save card/customer id for regular orders.
139
 
140
- = 2.2.7 - 2014.11.20 =
141
  * Fixed all instances where order IDs were used instead of user IDs.
142
  * Update orignal order card/customer ids for renewals.
143
  * Add reasons to refunds.
144
 
145
- = 2.2.6 - 2014.11.18 =
146
  * Stripe card ID should be taken from the order, not the user.
147
  * Fix order_meta_query.
148
 
149
- = 2.2.5 - 2014.11.06 =
150
  * Round totals to 2 decimals so when we multiply by 100 we're sure we've got an integer.
151
 
152
- = 2.2.4 - 2014.10.01 =
153
  * Fix card display for subscriptions.
154
 
155
- = 2.2.3 - 2014.10.01 =
156
  * Fixed textdomain name
157
 
158
- = 2.2.2 - 2014.09.23 =
159
  * Set API version to 2014-09-08.
160
  * Fixed card display (type->brand).
161
 
162
- = 2.2.1 - 2014.09.15 =
163
  * Fix strict standards warning.
164
 
165
- = 2.2.0 - 2014.09.01 =
166
  * Replaced woocommerce_get_template (deprecated) with wc_get_template.
167
  * Tweak refund support.
168
  * Support for pre-orders.
169
  * Fixed typo.
170
 
171
- = 2.1.0 - 2014.08.06 =
172
  * Associate stripe customers with wp users.
173
  * Refactored saved card code.
174
  * Use Stripe API to get and delete saved cards.
@@ -176,24 +305,24 @@
176
  * WC 2.2 - Store transaction ID.
177
  * WC 2.2 - Refund support.
178
 
179
- = 2.0.4 - 2014.07.31 =
180
  * Tweaked the stripe checkout submission method.
181
 
182
- = 2.0.3 - 2014.07.25 =
183
  * wc_stripe_manage_saved_cards_url filter.
184
  * Zero decimal currency handling.
185
  * Only open stripe model when required fields are completed.
186
 
187
- = 2.0.2 - 2014.06.06 =
188
  * Fix use of saved cards on subscriptions.
189
 
190
- = 2.0.1 - 2014.05.29 =
191
  * Fix ajax loading gif.
192
  * Fix notices.
193
  * Fix stray comma in stripe.js.
194
  * Prompt user to accept terms before showing stripe checkout modal.
195
 
196
- = 2.0.0 - 2014.05.21 =
197
  * Added the WC credit_card_form - this extension now requires WC 2.1+
198
  * Option to disable saved cards
199
  * Refactored code base
@@ -202,143 +331,143 @@
202
  * woocommerce_stripe_request_body filter
203
  * Store fees for subscriptions
204
 
205
- = 1.8.6 - 2014.05.20 =
206
  * correct SSl message
207
  * decode get_bloginfo( 'name' ) for plain text display
208
 
209
- = 1.8.5 - 2014.05.10 =
210
  * Updated textdomains
211
  * date_i18n
212
  * Improve stripe checkout flow - pop up on the checkout button click
213
 
214
- = 1.8.4 - 2014.04.01 =
215
  * Fix updating credit card used for future subscription payments when paying for a failed subscription renewal order with a new credit card.
216
 
217
- = 1.8.3 - 2014.02.13 =
218
  * Fix fatal error for subscription payments of deleted products.
219
 
220
- = 1.8.2 - 2014.02.06 =
221
  * Fix notice on card delete
222
 
223
- = 1.8.1 - 2014.01.28 =
224
  * set default for $checked
225
 
226
- = 1.8.0 - 2014.01.08 =
227
  * Checked compatibility with 2013-12-03 API
228
  * 2.1 compatibility
229
  * Pre-filled email address when using stripe checkout
230
 
231
- = 1.7.6 - 2013.12.02 =
232
  * Fix card display
233
 
234
- = 1.7.5 - 2013.11.27 =
235
  * Show payment method for subscriptions on account page
236
 
237
- = 1.7.4 - 2013.11.20 =
238
  * Expand/close when using saved cards.
239
  * Use balance_transaction to get and store fees
240
 
241
- = 1.7.3 - 2013.11.01 =
242
  * Default to saved card
243
 
244
- = 1.7.2 - 2013.11.01 =
245
  * Added missing global in update_failing_payment_method
246
 
247
- = 1.7.1 - 2013.09.28 =
248
  * Remove non-existant (yet) function
249
 
250
- = 1.7.0 - 2013.09.25 =
251
  * Different credit card image for US than for other countries + a filter.
252
  * Support for upcoming version of subscriptions.
253
  * Add new woocommerce_stripe_month_display filter
254
 
255
- = 1.6.0 - 2013.09.02 =
256
  * Option to define a Stripe Checkout Image
257
  * Removed currency check due to beta rollout
258
 
259
- = 1.5.14 - 2013.08.12 =
260
  * New cards format for subscriptions class.
261
 
262
- = 1.5.13 - 2013.07.24 =
263
  * Updated customer response object handler to work with new cards format.
264
  * Fixed delete card button
265
 
266
- = 1.5.12 - 2013.07.24 =
267
  * EUR support for Stripe Beta
268
 
269
- = 1.5.11 - 2013.07.17 =
270
  * Workaround for stripe error messages.
271
 
272
- = 1.5.10 - 2013.06.28 =
273
  * Store charge ID, fee in meta
274
 
275
- = 1.5.9 - 2013.06.28 =
276
  * Capture true default
277
 
278
- = 1.5.8 - 2013.06.18 =
279
  * Add currency to stripe checkout js
280
  * Authorize-only mode. Captures payment when order is made processing.
281
 
282
- = 1.5.7 - 2013.06.15 =
283
  * Added 'capture' option should you wish to authorize only. Authorized orders are on-hold. Processed orders capture the charge automatically.
284
 
285
- = 1.5.6 - 2013.06.03 =
286
  * added data-currency to stripe-checkout
287
 
288
- = 1.5.5 - 2013.04.26 =
289
  * Allow card re-entry in stripe checkout after errors.
290
 
291
- = 1.5.4 - 2013.04.19 =
292
  * GBP fix
293
 
294
- = 1.5.3 - 2013.04.15 =
295
  * Support GBP currency code (For UK Beta)
296
 
297
- = 1.5.2 - 2013.04.09 =
298
  * Send billing city to stripe
299
 
300
- = 1.5.1 - 2013.01.24 =
301
  * Add support for changing a subscription's recurring amount
302
 
303
- = 1.5.0 - 2013.01.18 =
304
  * Supports Stripe Checkout https://stripe.com/docs/checkout
305
 
306
- = 1.4.0 - 2013.01.18 =
307
  * WC 2.0 Compat
308
 
309
- = 1.3.5 - 2012.12.05 =
310
  * Pass address fields to stripe.js on pay page.
311
 
312
- = 1.3.4 - 2012.12.05 =
313
  * Updater
314
 
315
- = 1.3.3 - 2012.10.22 =
316
  * Fix CAD check
317
 
318
- = 1.3.2 - 2012.10.15 =
319
  * Fixed bug causing settings to not show when using CAD
320
 
321
- = 1.3.1 - 2012.10.11 =
322
  * Add support for changing subscription next payment date
323
  * Remove order meta from subscription renewal orders
324
 
325
- = 1.3 - 2012.09.20 =
326
  * Allowed canadian dollars - Stripe is beta testing support for Canada
327
 
328
- = 1.2.1 - 2012.09.11 =
329
  * Fix text mode SSL logic
330
 
331
- = 1.2 - 2012.09.01 =
332
  * SSL not required in TEST MODE
333
  * Saved cards - store customer tokens and let users pay again using the same card
334
  * Subscriptions use a single customer, rather than per-order
335
  * Only load JS on checkout
336
 
337
- = 1.1 - 2012.06.19 =
338
  * Update woo updater
339
  * Class name update
340
  * Stripe JS for added security - you will need to re-enter keys and ensure you are using WooCommerce 1.5.8
341
  * Subscriptions support (requires WC Subscriptions addon)
342
 
343
- = 1.0 - 2011.12.08 =
344
  * First Release
1
  *** Changelog ***
2
 
3
+ = 4.0.3 - 2018-01-18 =
4
+ * Fix - Pass Stripe source as id instead of object as some sites may conflict with objects being passed.
5
+ * Fix - For Payment Request Button, if test keys are not filled, it can cause live mode not to function.
6
+
7
+ = 4.0.2 - 2018-01-17 =
8
+ * Add - 3DS support on Stripe Checkout ( Modal Popup ).
9
+ * Add - Filter to enable Payment Request Button on Checkout 'wc_stripe_show_payment_request_on_checkout'.
10
+ * Add - Filter to remove all fields from checkout validation. 'wc_stripe_validate_checkout_all_fields'.
11
+ * Add - Filter to remove required fields from checkout validation. 'wc_stripe_validate_checkout_required_fields'.
12
+ * Add - Custom error exceptions class.
13
+ * Add - Credit card field names for clarity.
14
+ * Fix - Possible conflicts with payment request totals when subscriptions is active.
15
+ * Fix - Undefined notice on save card via subscriptions if card is deleted.
16
+ * Fix - Error translation issue when 3DS is required.
17
+ * Fix - Possible 404 if getting customer source if no id was found.
18
+ * Fix - Add payment method was still available when save cards setting is disabled.
19
+ * Fix - In certain cases when webhook is used, refunds can show as doubled when it is not.
20
+ * Fix - Stripe checkout with bitcoin returns error on processing.
21
+ * Tweak - Remove Sofort country selection in favor of using the billing country.
22
+ * Tweak - Add payment page CSS styling.
23
+ * Tweak - Error log to show full response object.
24
+
25
  = 4.0.2 - 2018-01-17 =
26
  * Add - 3DS support on Stripe Checkout ( Modal Popup ).
27
  * Add - Filter to enable Payment Request Button on Checkout 'wc_stripe_show_payment_request_on_checkout'.
58
  * Add - P24.
59
  * Add - Alipay.
60
 
61
+ = 3.2.3 - 2017-08-23 =
62
+ * Fix - Apple Pay action hook with wrong parameter causing errors.
63
+
64
+ = 3.2.2 - 2017-07-10 =
65
+ * Fix - Apple Pay button displaying in non Safari browser.
66
+ * Fix - Apple Pay with coupon not applying to total.
67
+
68
+ = 3.2.1 - 2017-06-25 =
69
+ * Fix - Discounts were not applying to total with Apple Pay.
70
+
71
+ = 3.2.0 - 2017-06-17 =
72
+ * Fix - Authorized first orders were not able to be refund.
73
+ * Fix - Payment Request not honoring different shipping address in certain cases.
74
+ * Fix - In certain Chrome versions, states are not abbreviated causing shipping validation issues with Payment Request API.
75
+ * Add - Support for Dynamic Pricing.
76
+
77
+ = 3.1.9 - 2017-05-25 =
78
+ * Fix - Handle a subscription renewal failed payment order correctly to prevent orders going into onhold status.
79
+ * Fix - Auto accept terms for Payment Request API to prevent blocker for the checkout.
80
+ * Fix - Add payment method via Stripe checkout button showed pricing.
81
+ * Fix - When Stripe customer id is no longer linked to Stripe account, customer not found can happen.
82
+ * Fix - On Subscription failed payment, new payment info not updating causing failed payments for recurring charges.
83
+ * Add - Action hook to manipulate process response from API "wc_gateway_stripe_process_response".
84
+ * Add - Apple Pay compatibility with WooCommerce Sequential Numbers Pro.
85
+
86
+ = 3.1.8 - 2017-05-08 =
87
+ * Fix - Legacy < WC 3.0 stripe checkout file reference link name causing file not found.
88
+
89
+ = 3.1.7 - 2017-04-19 =
90
+ * Fix - Additional WC 3.0 compatibility with subscriptions addons.
91
+ * Fix - Retry failed subscription payments with customer ID.
92
+ * Add - Site URL to metadata when charging subscription orders for reference.
93
+
94
+ = 3.1.6 - 2017-04-04 =
95
+ * Fix - TypeError issues on single product page when using Apple Pay on Desktop.
96
+ * Fix - In certain case, Apple Pay on single product page does not show shipping info.
97
+ * Fix - Use store's base location to show/hide accepted credit cards instead of currency.
98
+ * Fix - Unsupported product type when a variable product is added with Apple Pay.
99
+
100
+ = 3.1.5 - 2017-03-30 =
101
+ * Add - Check for WP error object in domain verification.
102
+
103
+ = 3.1.4 - 2017-03-30 =
104
+ * Tweak - If Apple Pay is not enabled, prevent Apple Pay Init.
105
+ * Fix - Update for WooCommerce 3.0 compatibility.
106
+ * Fix - Apple Pay on product detail page causes qty issue when using normal add to cart.
107
+ * Fix - A partial workaround for UK/CA postal codes issue for shipping methods that support partial postal code estimates.
108
+ * Fix - Stripe checkout did not validate properly formatted email address.
109
+ * Fix - Error messages were not able to translate when validating checkout form.
110
+ * Fix - Prevent payment gateway title logic ( Apple Pay ) from hijacking other payment methods.
111
+ * Remove - Stripe Checkout allow remember me setting as it is redundant to saved card setting.
112
+
113
+ = 3.1.3 - 2017-03-17 =
114
+ * Fix - When using Stripe Checkout, add payment method was disabled.
115
+ * Fix - Possible non object type when using preview pages.
116
+
117
+ = 3.1.2 - 2017-03-16 =
118
+ * Fix - Add payment method on My Account page error.
119
+
120
+ = 3.1.1 - 2017-03-16 =
121
+ * Fix - Apple Pay error notice log link is incorrect.
122
+ * Fix - Apple Pay domain verification paths check.
123
+
124
+ = 3.1.0 - 2017-03-15 =
125
+ * New - Apple Pay Support.
126
+ * New - Add Google Payment Request API.
127
+ * New - Minimum PHP 5.6.
128
+
129
+ = 3.0.7 - 2017-01-12 =
130
+ * New - Option to allow/disallow remember me on Stripe checkout modal.
131
+ * Fix - Paying for order incorrectly uses cart amount.
132
+ * Fix - Using WC function before checking exists causes fatal error.
133
+
134
+ = 3.0.6 - 2016-11-09 =
135
+ * Fix - When adding declined cards, fatal error is thrown.
136
+ * Fix - After a failed/declined process, valid cards are not accepted.
137
+ * Fix - When paying via pay order page/link, billing info is not sent.
138
+ * Fix - Account for all types of errors for proper localization.
139
+ * Fix - Correctly reference Stripe fees/net based on Stripe account locale.
140
+ * Fix - Bitcoin image not showing.
141
+ * New - Introduce "wc_gateway_stripe_process_payment_error" action hook.
142
+ * New - Introduce "wc_gateway_stripe_process_payment" action hook.
143
+
144
+ = 3.0.5 - 2016-11-03 =
145
+ * Fix - Previous upload of files didn't take. Retry.
146
+
147
+ = 3.0.4 - 2016-09-28 =
148
+ * Fix - Missing min files.
149
+
150
+ = 3.0.3 - 2016-09-27 =
151
+ * Fix - Remove bitcoin icon when not using Stripe Checkout mode as it is not supported.
152
+ * Fix - Failed payment order was not sending email to admin.
153
+ * Fix - Saved card option was not being honored.
154
+ * New - Filter for WC_Payment_Gateway_CC::wc_stripe_generate_payment_request return value.
155
+ * New - Filter to disallow prepaid cards. "wc_stripe_allow_prepaid_card".
156
+ * New - Filter to require billing address on Stripe Modal Checkout. "wc_stripe_checkout_require_billing_address".
157
+ * New - Localized Stripe error messages.
158
+
159
+ = 3.0.2 - 2016-06-14 =
160
  * Fix - Set empty array as default value for first argument in WC_Stripe_Customer::create_customer
161
  * Tweak - Update default title to make it consistent with existing titles
162
 
163
+ = 3.0.1 - 2016-06-08 =
164
+ * Backwards compatibility update to prevent error finding WC_Payment_Token_CC.
165
+ * Added inline validation of keys.
166
+
167
+ = 3.0.0 - 2016-06-07 =
168
+ * First public WordPress.org release.
169
+ * Refactor for WC 2.6 and above. Legacy support for 2.5.
170
+ * Improved saved card handling using tokenization API in WooCommerce.
171
+
172
+ = 2.6.12 - 2016-04-13 =
173
  * Fix - When saved cards option is enabled with no cards on file, CC field was hidden.
174
 
175
+ = 2.6.11 - 2016-04-11 =
176
  * Add - Option to set a default card in manage card section and detect previous card paid by subscription.
177
  * Fix - Admin notice link when key is not added and when addons are present.
178
 
179
+ = 2.6.10 - 2016-03-16 =
180
  * Tweak - Add logging mechanism. New 'Logging' option is added in Stripe gateway setting to enable logging.
181
  * Fix - Allow language files to be located outside of plugin directory
182
 
183
+ = 2.6.9 - 2016-02-29 =
184
  * Tweak - Allow mechanism to override Stripe JS error handler. See https://gist.github.com/gedex/240492f479c7443e4780
185
  for an example to override error handler with simple alert.
186
 
187
+ = 2.6.8 - 2016-02-11 =
188
  * Tweak - Include card brand in saved cards radio label class
189
  * Tweak - Add action when deleting card
190
  * Tweak - Add actions for add_card and add_customer
191
  * Tweak - Add support for automatic localisation in Stripe Checkout modal
192
  * Fix - Check for Stripe error code emptiness before returning the WP_Error
193
 
194
+ = 2.6.7 - 2015-12-17 =
195
  * Fix is_available SSL check to also work properly on hosts that always serve HTTPS
196
 
197
+ = 2.6.6 - 2015-12-03 =
198
  * Fix a JavaScript bug introduced in 2.6.4 that caused checkout with a saved card to fail
199
 
200
+ = 2.6.5 - 2015-12-02 =
201
  * Do not require a card id when updating a subscription payment method
202
 
203
+ = 2.6.4 - 2015-11-20 =
204
  * Fix a JavaScript bug that caused the Stripe Checkout popup to be blocked on Chrome for iOS
205
 
206
+ = 2.6.3 - 2015-11-12 =
207
  * Add metadata to subscription payments in stripe dashboard to indicate whether it is the initial or a recurring payment
208
 
209
+ = 2.6.2 - 2015-11-06 =
210
  * Fix bug that would cause multiple subscriptions to not be supported under certain circumstances
211
 
212
+ = 2.6.1 - 2015-09-15 =
213
  * Unset source if not set during pre-order release payments.
214
  * Store customer ID if not logged in for pre-order payments.
215
 
216
+ = 2.6.0 - 2015-09-02 =
217
  * Subscriptions 2.0 support.
218
 
219
+ = 2.5.4 - 2015-08-11 =
220
  * Tweak - Terms and conditions error styling when required
221
  * Tweak - Account password error styling when required
222
 
223
+ = 2.5.3 - 201-.7-28 =
224
  * Added - Filter to prevent Stripe from sending its own receipts "wc_stripe_send_stripe_receipt"
225
 
226
+ = 2.5.2 - 2015-07-19 =
227
  * Fix - Removed deprecated add_error function
228
  * Tweak - Improve error message when Stripe checkout function is used
229
 
230
+ = 2.5.1 - 2015-07-01 =
231
  * Fix - Only send receipt_email when set.
232
 
233
+ = 2.5.0 - 2015-05-11 =
234
  * Update to API version 2015-04-07
235
  * Feature - Support authorize on subscriptions first payment.
236
  * Tweak - Option labels.
239
  * Tweak - Update card icons.
240
  * Tweak - Pass receipt email.
241
 
242
+ = 2.4.3 - 2015-05-11 =
243
  * Fix - fixed validation issue when account creation is not checked
244
  * Update - Stripe checkout JS API v2
245
 
246
+ = 2.4.2 - 2015-03-23 =
247
  * Fix - Create account password field was not being validated
248
 
249
+ = 2.4.1 - 2015-03-20 =
250
  * Fix - Undefined JS error due to deprecated ajax_loader_url
251
  * Fix - When using Stripe checkout JS, some form required fields were not validating
252
 
253
+ = 2.4.0 - 2015-02-20 =
254
  * Added support for bitcoin currency
255
 
256
+ = 2.3.0 - 2015-01-31 =
257
  * Added 'wc_stripe_description' filter to allow filtering of payment description.
258
  * Added order_review handling for stripe checkout.
259
  * Mark order as failed is Stripe API call fails
263
  * Fix fees where not logged correctly when using authorized first capture later
264
  * Retry payment if customer_id is invalid.
265
 
266
+ = 2.2.8 - 2014-11-21 =
267
  * Save card/customer id for regular orders.
268
 
269
+ = 2.2.7 - 2014-11-20 =
270
  * Fixed all instances where order IDs were used instead of user IDs.
271
  * Update orignal order card/customer ids for renewals.
272
  * Add reasons to refunds.
273
 
274
+ = 2.2.6 - 2014-11-18 =
275
  * Stripe card ID should be taken from the order, not the user.
276
  * Fix order_meta_query.
277
 
278
+ = 2.2.5 - 2014-11-06 =
279
  * Round totals to 2 decimals so when we multiply by 100 we're sure we've got an integer.
280
 
281
+ = 2.2.4 - 2014-10-01 =
282
  * Fix card display for subscriptions.
283
 
284
+ = 2.2.3 - 2014-10-01 =
285
  * Fixed textdomain name
286
 
287
+ = 2.2.2 - 2014-09-23 =
288
  * Set API version to 2014-09-08.
289
  * Fixed card display (type->brand).
290
 
291
+ = 2.2.1 - 2014-09-15 =
292
  * Fix strict standards warning.
293
 
294
+ = 2.2.0 - 2014-09-01 =
295
  * Replaced woocommerce_get_template (deprecated) with wc_get_template.
296
  * Tweak refund support.
297
  * Support for pre-orders.
298
  * Fixed typo.
299
 
300
+ = 2.1.0 - 2014-08-06 =
301
  * Associate stripe customers with wp users.
302
  * Refactored saved card code.
303
  * Use Stripe API to get and delete saved cards.
305
  * WC 2.2 - Store transaction ID.
306
  * WC 2.2 - Refund support.
307
 
308
+ = 2.0.4 - 2014-07-31 =
309
  * Tweaked the stripe checkout submission method.
310
 
311
+ = 2.0.3 - 2014-07-25 =
312
  * wc_stripe_manage_saved_cards_url filter.
313
  * Zero decimal currency handling.
314
  * Only open stripe model when required fields are completed.
315
 
316
+ = 2.0.2 - 2014-06-06 =
317
  * Fix use of saved cards on subscriptions.
318
 
319
+ = 2.0.1 - 2014-05-29 =
320
  * Fix ajax loading gif.
321
  * Fix notices.
322
  * Fix stray comma in stripe.js.
323
  * Prompt user to accept terms before showing stripe checkout modal.
324
 
325
+ = 2.0.0 - 2014-05-21 =
326
  * Added the WC credit_card_form - this extension now requires WC 2.1+
327
  * Option to disable saved cards
328
  * Refactored code base
331
  * woocommerce_stripe_request_body filter
332
  * Store fees for subscriptions
333
 
334
+ = 1.8.6 - 2014-05-20 =
335
  * correct SSl message
336
  * decode get_bloginfo( 'name' ) for plain text display
337
 
338
+ = 1.8.5 - 2014-05-10 =
339
  * Updated textdomains
340
  * date_i18n
341
  * Improve stripe checkout flow - pop up on the checkout button click
342
 
343
+ = 1.8.4 - 2014-04-01 =
344
  * Fix updating credit card used for future subscription payments when paying for a failed subscription renewal order with a new credit card.
345
 
346
+ = 1.8.3 - 2014-02-13 =
347
  * Fix fatal error for subscription payments of deleted products.
348
 
349
+ = 1.8.2 - 2014-02-06 =
350
  * Fix notice on card delete
351
 
352
+ = 1.8.1 - 2014-01-28 =
353
  * set default for $checked
354
 
355
+ = 1.8.0 - 2014-01-08 =
356
  * Checked compatibility with 2013-12-03 API
357
  * 2.1 compatibility
358
  * Pre-filled email address when using stripe checkout
359
 
360
+ = 1.7.6 - 2013-12-02 =
361
  * Fix card display
362
 
363
+ = 1.7.5 - 2013-11-27 =
364
  * Show payment method for subscriptions on account page
365
 
366
+ = 1.7.4 - 2013-11-20 =
367
  * Expand/close when using saved cards.
368
  * Use balance_transaction to get and store fees
369
 
370
+ = 1.7.3 - 2013-11-01 =
371
  * Default to saved card
372
 
373
+ = 1.7.2 - 2013-11-01 =
374
  * Added missing global in update_failing_payment_method
375
 
376
+ = 1.7.1 - 2013-09-28 =
377
  * Remove non-existant (yet) function
378
 
379
+ = 1.7.0 - 2013-09-25 =
380
  * Different credit card image for US than for other countries + a filter.
381
  * Support for upcoming version of subscriptions.
382
  * Add new woocommerce_stripe_month_display filter
383
 
384
+ = 1.6.0 - 2013-09-02 =
385
  * Option to define a Stripe Checkout Image
386
  * Removed currency check due to beta rollout
387
 
388
+ = 1.5.14 - 2013-08-12 =
389
  * New cards format for subscriptions class.
390
 
391
+ = 1.5.13 - 2013-07-24 =
392
  * Updated customer response object handler to work with new cards format.
393
  * Fixed delete card button
394
 
395
+ = 1.5.12 - 2013-07-24 =
396
  * EUR support for Stripe Beta
397
 
398
+ = 1.5.11 - 2013-07-17 =
399
  * Workaround for stripe error messages.
400
 
401
+ = 1.5.10 - 2013-06-28 =
402
  * Store charge ID, fee in meta
403
 
404
+ = 1.5.9 - 2013-06-28 =
405
  * Capture true default
406
 
407
+ = 1.5.8 - 2013-06-18 =
408
  * Add currency to stripe checkout js
409
  * Authorize-only mode. Captures payment when order is made processing.
410
 
411
+ = 1.5.7 - 2013-06-15 =
412
  * Added 'capture' option should you wish to authorize only. Authorized orders are on-hold. Processed orders capture the charge automatically.
413
 
414
+ = 1.5.6 - 2013-06-03 =
415
  * added data-currency to stripe-checkout
416
 
417
+ = 1.5.5 - 2013-04-26 =
418
  * Allow card re-entry in stripe checkout after errors.
419
 
420
+ = 1.5.4 - 2013-04-19 =
421
  * GBP fix
422
 
423
+ = 1.5.3 - 2013-04-15 =
424
  * Support GBP currency code (For UK Beta)
425
 
426
+ = 1.5.2 - 2013-04-09 =
427
  * Send billing city to stripe
428
 
429
+ = 1.5.1 - 2013-01-24 =
430
  * Add support for changing a subscription's recurring amount
431
 
432
+ = 1.5.0 - 2013-01-18 =
433
  * Supports Stripe Checkout https://stripe.com/docs/checkout
434
 
435
+ = 1.4.0 - 2013-01-18 =
436
  * WC 2.0 Compat
437
 
438
+ = 1.3.5 - 2012-12-05 =
439
  * Pass address fields to stripe.js on pay page.
440
 
441
+ = 1.3.4 - 2012-12-05 =
442
  * Updater
443
 
444
+ = 1.3.3 - 2012-10-22 =
445
  * Fix CAD check
446
 
447
+ = 1.3.2 - 2012-10-15 =
448
  * Fixed bug causing settings to not show when using CAD
449
 
450
+ = 1.3.1 - 2012-10-11 =
451
  * Add support for changing subscription next payment date
452
  * Remove order meta from subscription renewal orders
453
 
454
+ = 1.3 - 2012-09-20 =
455
  * Allowed canadian dollars - Stripe is beta testing support for Canada
456
 
457
+ = 1.2.1 - 2012-09-11 =
458
  * Fix text mode SSL logic
459
 
460
+ = 1.2 - 2012-09-01 =
461
  * SSL not required in TEST MODE
462
  * Saved cards - store customer tokens and let users pay again using the same card
463
  * Subscriptions use a single customer, rather than per-order
464
  * Only load JS on checkout
465
 
466
+ = 1.1 - 2012-06-19 =
467
  * Update woo updater
468
  * Class name update
469
  * Stripe JS for added security - you will need to re-enter keys and ensure you are using WooCommerce 1.5.8
470
  * Subscriptions support (requires WC Subscriptions addon)
471
 
472
+ = 1.0 - 2011-12-08 =
473
  * First Release
includes/abstracts/abstract-wc-stripe-payment-gateway.php CHANGED
@@ -350,6 +350,27 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
350
  return (object) apply_filters( 'wc_stripe_owner_details', $details, $order );
351
  }
352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  /**
354
  * Get payment source. This can be a new token/source or existing WC token.
355
  * If user is logged in and/or has WC account, create an account on Stripe.
@@ -357,13 +378,14 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
357
  *
358
  * @since 3.1.0
359
  * @version 4.0.0
 
360
  * @param string $user_id
361
  * @param bool $force_save_source Should we force save payment source.
362
  *
363
  * @throws Exception When card was not added or for and invalid card.
364
  * @return object
365
  */
366
- public function prepare_source( $user_id, $force_save_source = false ) {
367
  $customer = new WC_Stripe_Customer( $user_id );
368
  $set_customer = true;
369
  $force_save_source = apply_filters( 'wc_stripe_force_save_source', $force_save_source, $customer );
@@ -372,9 +394,9 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
372
  $payment_method = isset( $_POST['payment_method'] ) ? wc_clean( $_POST['payment_method'] ) : 'stripe';
373
 
374
  // New CC info was entered and we have a new source to process.
375
- if ( ! empty( $_POST['stripe_source'] ) ) {
376
  // This gets the source object from Stripe.
377
- $source = json_decode( wc_clean( stripslashes( $_POST['stripe_source'] ) ) );
378
 
379
  // This checks to see if customer opted to save the payment method to file.
380
  $maybe_saved_card = isset( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] ) && ! empty( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] );
@@ -637,14 +659,16 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
637
 
638
  $stripe_customer = new WC_Stripe_Customer( get_current_user_id() );
639
 
640
- if ( isset( $_POST['stripe_source'] ) ) {
641
- $source = json_decode( wc_clean( stripslashes( $_POST['stripe_source'] ) ) );
 
642
 
643
- if ( ! empty( $source->error ) ) {
 
644
  $error = true;
645
  }
646
 
647
- $source_id = $source->id;
648
  } elseif ( isset( $_POST['stripe_token'] ) ) {
649
  $source_id = wc_clean( $_POST['stripe_token'] );
650
  }
@@ -657,6 +681,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
657
 
658
  if ( $error ) {
659
  wc_add_notice( $error_msg, 'error' );
 
660
  return;
661
  }
662
 
350
  return (object) apply_filters( 'wc_stripe_owner_details', $details, $order );
351
  }
352
 
353
+ /**
354
+ * Create source object by source id.
355
+ *
356
+ * @since 4.0.3
357
+ */
358
+ public function create_source_object() {
359
+ $source = ! empty( $_POST['stripe_source'] ) ? wc_clean( $_POST['stripe_source'] ) : '';
360
+
361
+ if ( empty( $source ) ) {
362
+ return '';
363
+ }
364
+
365
+ $source_object = WC_Stripe_API::retrieve( 'sources/' . $source );
366
+
367
+ if ( ! empty( $source_object->error ) ) {
368
+ throw new WC_Stripe_Exception( print_r( $source_object, true ), $source_object->error->message );
369
+ }
370
+
371
+ return $source_object;
372
+ }
373
+
374
  /**
375
  * Get payment source. This can be a new token/source or existing WC token.
376
  * If user is logged in and/or has WC account, create an account on Stripe.
378
  *
379
  * @since 3.1.0
380
  * @version 4.0.0
381
+ * @param object $source_object
382
  * @param string $user_id
383
  * @param bool $force_save_source Should we force save payment source.
384
  *
385
  * @throws Exception When card was not added or for and invalid card.
386
  * @return object
387
  */
388
+ public function prepare_source( $source_object = '', $user_id, $force_save_source = false ) {
389
  $customer = new WC_Stripe_Customer( $user_id );
390
  $set_customer = true;
391
  $force_save_source = apply_filters( 'wc_stripe_force_save_source', $force_save_source, $customer );
394
  $payment_method = isset( $_POST['payment_method'] ) ? wc_clean( $_POST['payment_method'] ) : 'stripe';
395
 
396
  // New CC info was entered and we have a new source to process.
397
+ if ( ! empty( $source_object ) ) {
398
  // This gets the source object from Stripe.
399
+ $source = $source_object;
400
 
401
  // This checks to see if customer opted to save the payment method to file.
402
  $maybe_saved_card = isset( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] ) && ! empty( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] );
659
 
660
  $stripe_customer = new WC_Stripe_Customer( get_current_user_id() );
661
 
662
+ $source = ! empty( $_POST['stripe_source'] ) ? wc_clean( $_POST['stripe_source'] ) : '';
663
+
664
+ $source_object = WC_Stripe_API::retrieve( 'sources/' . $source );
665
 
666
+ if ( isset( $source_object ) ) {
667
+ if ( ! empty( $source_object->error ) ) {
668
  $error = true;
669
  }
670
 
671
+ $source_id = $source_object->id;
672
  } elseif ( isset( $_POST['stripe_token'] ) ) {
673
  $source_id = wc_clean( $_POST['stripe_token'] );
674
  }
681
 
682
  if ( $error ) {
683
  wc_add_notice( $error_msg, 'error' );
684
+ WC_Stripe_Logger::log( 'Add payment method Error: ' . $error_msg );
685
  return;
686
  }
687
 
includes/admin/stripe-settings.php CHANGED
@@ -173,7 +173,7 @@ return apply_filters( 'wc_stripe_settings',
173
  'label' => __( 'Button Theme', 'woocommerce-gateway-stripe' ),
174
  'type' => 'select',
175
  'description' => __( 'Select the button theme you would like to show.', 'woocommerce-gateway-stripe' ),
176
- 'default' => 'default',
177
  'desc_tip' => true,
178
  'options' => array(
179
  'dark' => __( 'Dark', 'woocommerce-gateway-stripe' ),
173
  'label' => __( 'Button Theme', 'woocommerce-gateway-stripe' ),
174
  'type' => 'select',
175
  'description' => __( 'Select the button theme you would like to show.', 'woocommerce-gateway-stripe' ),
176
+ 'default' => 'dark',
177
  'desc_tip' => true,
178
  'options' => array(
179
  'dark' => __( 'Dark', 'woocommerce-gateway-stripe' ),
includes/class-wc-gateway-stripe.php CHANGED
@@ -467,7 +467,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
467
  </div>
468
  <?php } else { ?>
469
  <div class="form-row form-row-wide">
470
- <label><?php _e( 'Card Number', 'woocommerce-gateway-stripe' ); ?><span class="required">*</span></label>
471
 
472
  <div id="stripe-card-element" style="background:#fff;padding:0 1em;border:1px solid #ddd;margin:5px 0;padding:10px 5px;">
473
  <!-- a Stripe Element will be inserted here. -->
@@ -475,7 +475,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
475
  </div>
476
 
477
  <div class="form-row form-row-first">
478
- <label><?php _e( 'Expiry Date', 'woocommerce-gateway-stripe' ); ?><span class="required">*</span></label>
479
 
480
  <div id="stripe-exp-element" style="background:#fff;padding:0 1em;border:1px solid #ddd;margin:5px 0;padding:10px 5px;">
481
  <!-- a Stripe Element will be inserted here. -->
@@ -483,7 +483,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
483
  </div>
484
 
485
  <div class="form-row form-row-last">
486
- <label><?php _e( 'Card Code (CVC)', 'woocommerce-gateway-stripe' ); ?><span class="required">*</span></label>
487
  <div id="stripe-cvc-element" style="background:#fff;padding:0 1em;border:1px solid #ddd;margin:5px 0;padding:10px 5px;">
488
  <!-- a Stripe Element will be inserted here. -->
489
  </div>
@@ -633,8 +633,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
633
  */
634
  public function process_payment( $order_id, $retry = true, $force_save_source = false ) {
635
  try {
636
- $order = wc_get_order( $order_id );
637
- $source_object = ! empty( $_POST['stripe_source'] ) ? json_decode( wc_clean( stripslashes( $_POST['stripe_source'] ) ) ) : false;
638
 
639
  // This comes from the create account checkbox in the checkout page.
640
  $create_account = ! empty( $_POST['createaccount'] ) ? true : false;
@@ -645,15 +644,15 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
645
  $new_stripe_customer->create_customer();
646
  }
647
 
648
- $prepared_source = $this->prepare_source( get_current_user_id(), $force_save_source );
 
 
649
 
650
  // Check if we don't allow prepaid credit cards.
651
  if ( ! apply_filters( 'wc_stripe_allow_prepaid_card', true ) ) {
652
- $stripe_checkout_object = ! empty( $_POST['stripe_checkout_object'] ) ? json_decode( wc_clean( stripslashes( $_POST['stripe_checkout_object'] ) ) ) : false;
653
-
654
- if ( $stripe_checkout_object && 'token' === $stripe_checkout_object->object && 'prepaid' === $stripe_checkout_object->card->funding ) {
655
  $localized_message = __( 'Sorry, we\'re not accepting prepaid cards at this time. Your credit card has not been charge. Please try with alternative payment method.', 'woocommerce-gateway-stripe' );
656
- throw new WC_Stripe_Exception( print_r( $stripe_checkout_object, true ), $localized_message );
657
  }
658
  }
659
 
467
  </div>
468
  <?php } else { ?>
469
  <div class="form-row form-row-wide">
470
+ <label><?php _e( 'Card Number', 'woocommerce-gateway-stripe' ); ?> <span class="required">*</span></label>
471
 
472
  <div id="stripe-card-element" style="background:#fff;padding:0 1em;border:1px solid #ddd;margin:5px 0;padding:10px 5px;">
473
  <!-- a Stripe Element will be inserted here. -->
475
  </div>
476
 
477
  <div class="form-row form-row-first">
478
+ <label><?php _e( 'Expiry Date', 'woocommerce-gateway-stripe' ); ?> <span class="required">*</span></label>
479
 
480
  <div id="stripe-exp-element" style="background:#fff;padding:0 1em;border:1px solid #ddd;margin:5px 0;padding:10px 5px;">
481
  <!-- a Stripe Element will be inserted here. -->
483
  </div>
484
 
485
  <div class="form-row form-row-last">
486
+ <label><?php _e( 'Card Code (CVC)', 'woocommerce-gateway-stripe' ); ?> <span class="required">*</span></label>
487
  <div id="stripe-cvc-element" style="background:#fff;padding:0 1em;border:1px solid #ddd;margin:5px 0;padding:10px 5px;">
488
  <!-- a Stripe Element will be inserted here. -->
489
  </div>
633
  */
634
  public function process_payment( $order_id, $retry = true, $force_save_source = false ) {
635
  try {
636
+ $order = wc_get_order( $order_id );
 
637
 
638
  // This comes from the create account checkbox in the checkout page.
639
  $create_account = ! empty( $_POST['createaccount'] ) ? true : false;
644
  $new_stripe_customer->create_customer();
645
  }
646
 
647
+ $source_object = $this->create_source_object();
648
+
649
+ $prepared_source = $this->prepare_source( $source_object, get_current_user_id(), $force_save_source );
650
 
651
  // Check if we don't allow prepaid credit cards.
652
  if ( ! apply_filters( 'wc_stripe_allow_prepaid_card', true ) ) {
653
+ if ( $source_object && 'token' === $source_object->object && 'prepaid' === $source_object->card->funding ) {
 
 
654
  $localized_message = __( 'Sorry, we\'re not accepting prepaid cards at this time. Your credit card has not been charge. Please try with alternative payment method.', 'woocommerce-gateway-stripe' );
655
+ throw new WC_Stripe_Exception( print_r( $source_object, true ), $localized_message );
656
  }
657
  }
658
 
includes/compat/class-wc-stripe-compat.php CHANGED
@@ -427,7 +427,7 @@ class WC_Stripe_Compat extends WC_Gateway_Stripe {
427
  throw new Exception( sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) );
428
  }
429
 
430
- $source = $this->prepare_source( get_current_user_id(), true );
431
 
432
  // We need a source on file to continue.
433
  if ( empty( $source->customer ) || empty( $source->source ) ) {
427
  throw new Exception( sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) );
428
  }
429
 
430
+ $source = $this->prepare_source( $this->create_source_object(), get_current_user_id(), true );
431
 
432
  // We need a source on file to continue.
433
  if ( empty( $source->customer ) || empty( $source->source ) ) {
includes/compat/class-wc-stripe-sepa-compat.php CHANGED
@@ -426,7 +426,7 @@ class WC_Stripe_Sepa_Compat extends WC_Gateway_Stripe_Sepa {
426
  throw new Exception( sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) );
427
  }
428
 
429
- $source = $this->prepare_source( get_current_user_id(), true );
430
 
431
  // We need a source on file to continue.
432
  if ( empty( $source->customer ) || empty( $source->source ) ) {
426
  throw new Exception( sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) );
427
  }
428
 
429
+ $source = $this->prepare_source( $this->create_source_object(), get_current_user_id(), true );
430
 
431
  // We need a source on file to continue.
432
  if ( empty( $source->customer ) || empty( $source->source ) ) {
includes/payment-methods/class-wc-gateway-stripe-bitcoin.php CHANGED
@@ -353,7 +353,6 @@ class WC_Gateway_Stripe_Bitcoin extends WC_Stripe_Payment_Gateway {
353
  public function process_payment( $order_id, $retry = true, $force_save_source = false ) {
354
  try {
355
  $order = wc_get_order( $order_id );
356
- $source_object = ! empty( $_POST['stripe_source'] ) ? json_decode( stripslashes( $_POST['stripe_source'] ) ) : false;
357
 
358
  // This comes from the create account checkbox in the checkout page.
359
  $create_account = ! empty( $_POST['createaccount'] ) ? true : false;
@@ -364,7 +363,7 @@ class WC_Gateway_Stripe_Bitcoin extends WC_Stripe_Payment_Gateway {
364
  $new_stripe_customer->create_customer();
365
  }
366
 
367
- $prepared_source = $this->prepare_source( get_current_user_id(), $force_save_source );
368
 
369
  if ( empty( $prepared_source->source ) ) {
370
  $localized_message = __( 'Payment processing failed. Please retry.', 'woocommerce-gateway-stripe' );
@@ -378,7 +377,7 @@ class WC_Gateway_Stripe_Bitcoin extends WC_Stripe_Payment_Gateway {
378
  // This will throw exception if not valid.
379
  $this->validate_minimum_order_amount( $order );
380
 
381
- $this->save_instructions( $order, $source_object );
382
 
383
  // Mark as on-hold (we're awaiting the payment)
384
  $order->update_status( 'on-hold', __( 'Awaiting Bitcoin payment', 'woocommerce-gateway-stripe' ) );
353
  public function process_payment( $order_id, $retry = true, $force_save_source = false ) {
354
  try {
355
  $order = wc_get_order( $order_id );
 
356
 
357
  // This comes from the create account checkbox in the checkout page.
358
  $create_account = ! empty( $_POST['createaccount'] ) ? true : false;
363
  $new_stripe_customer->create_customer();
364
  }
365
 
366
+ $prepared_source = $this->prepare_source( $this->create_source_object(), get_current_user_id(), $force_save_source );
367
 
368
  if ( empty( $prepared_source->source ) ) {
369
  $localized_message = __( 'Payment processing failed. Please retry.', 'woocommerce-gateway-stripe' );
377
  // This will throw exception if not valid.
378
  $this->validate_minimum_order_amount( $order );
379
 
380
+ $this->save_instructions( $order, $this->create_source_object() );
381
 
382
  // Mark as on-hold (we're awaiting the payment)
383
  $order->update_status( 'on-hold', __( 'Awaiting Bitcoin payment', 'woocommerce-gateway-stripe' ) );
includes/payment-methods/class-wc-gateway-stripe-sepa.php CHANGED
@@ -333,7 +333,7 @@ class WC_Gateway_Stripe_Sepa extends WC_Stripe_Payment_Gateway {
333
  $new_stripe_customer->create_customer();
334
  }
335
 
336
- $prepared_source = $this->prepare_source( get_current_user_id(), $force_save_source );
337
 
338
  // Store source to order meta.
339
  $this->save_source( $order, $prepared_source );
333
  $new_stripe_customer->create_customer();
334
  }
335
 
336
+ $prepared_source = $this->prepare_source( $this->create_source_object(), get_current_user_id(), $force_save_source );
337
 
338
  // Store source to order meta.
339
  $this->save_source( $order, $prepared_source );
includes/payment-methods/class-wc-stripe-payment-request.php CHANGED
@@ -35,6 +35,20 @@ class WC_Stripe_Payment_Request {
35
  */
36
  public $total_label;
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * Initialize class actions.
40
  *
@@ -43,10 +57,15 @@ class WC_Stripe_Payment_Request {
43
  */
44
  public function __construct() {
45
  $this->stripe_settings = get_option( 'woocommerce_stripe_settings', array() );
46
- $this->publishable_key = $this->get_publishable_key();
 
47
  $this->stripe_checkout_enabled = isset( $this->stripe_settings['stripe_checkout'] ) && 'yes' === $this->stripe_settings['stripe_checkout'];
48
  $this->total_label = ! empty( $this->stripe_settings['statement_descriptor'] ) ? WC_Stripe_Helper::clean_statement_descriptor( $this->stripe_settings['statement_descriptor'] ) : '';
49
 
 
 
 
 
50
  // If both site title and statement descriptor is not set. Fallback.
51
  if ( empty( $this->total_label ) ) {
52
  $this->total_label = $_SERVER['SERVER_NAME'];
@@ -134,27 +153,6 @@ class WC_Stripe_Payment_Request {
134
  }
135
  }
136
 
137
- /**
138
- * Get publishable key.
139
- *
140
- * @return string
141
- */
142
- protected function get_publishable_key() {
143
- if ( empty( $this->stripe_settings ) ) {
144
- return '';
145
- }
146
-
147
- if ( empty( $this->stripe_settings['testmode'] ) ) {
148
- return '';
149
- }
150
-
151
- if ( empty( $this->stripe_settings['test_publishable_key'] ) ) {
152
- return '';
153
- }
154
-
155
- return 'yes' === $this->stripe_settings['testmode'] ? $this->stripe_settings['test_publishable_key'] : $this->stripe_settings['publishable_key'];
156
- }
157
-
158
  /**
159
  * Gets the button type.
160
  *
@@ -413,7 +411,7 @@ class WC_Stripe_Payment_Request {
413
  array(
414
  'ajax_url' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
415
  'stripe' => array(
416
- 'key' => $this->get_publishable_key(),
417
  'allow_prepaid_card' => apply_filters( 'wc_stripe_allow_prepaid_card', true ) ? 'yes' : 'no',
418
  ),
419
  'nonce' => array(
35
  */
36
  public $total_label;
37
 
38
+ /**
39
+ * Key
40
+ *
41
+ * @var
42
+ */
43
+ public $publishable_key;
44
+
45
+ /**
46
+ * Is test mode active?
47
+ *
48
+ * @var bool
49
+ */
50
+ public $testmode;
51
+
52
  /**
53
  * Initialize class actions.
54
  *
57
  */
58
  public function __construct() {
59
  $this->stripe_settings = get_option( 'woocommerce_stripe_settings', array() );
60
+ $this->testmode = ( ! empty( $this->stripe_settings['testmode'] ) && 'yes' === $this->stripe_settings['testmode'] ) ? true : false;
61
+ $this->publishable_key = ! empty( $this->stripe_settings['publishable_key'] ) ? $this->stripe_settings['publishable_key'] : '';
62
  $this->stripe_checkout_enabled = isset( $this->stripe_settings['stripe_checkout'] ) && 'yes' === $this->stripe_settings['stripe_checkout'];
63
  $this->total_label = ! empty( $this->stripe_settings['statement_descriptor'] ) ? WC_Stripe_Helper::clean_statement_descriptor( $this->stripe_settings['statement_descriptor'] ) : '';
64
 
65
+ if ( $this->testmode ) {
66
+ $this->publishable_key = ! empty( $this->stripe_settings['test_publishable_key'] ) ? $this->stripe_settings['test_publishable_key'] : '';
67
+ }
68
+
69
  // If both site title and statement descriptor is not set. Fallback.
70
  if ( empty( $this->total_label ) ) {
71
  $this->total_label = $_SERVER['SERVER_NAME'];
153
  }
154
  }
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  /**
157
  * Gets the button type.
158
  *
411
  array(
412
  'ajax_url' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
413
  'stripe' => array(
414
+ 'key' => $this->publishable_key,
415
  'allow_prepaid_card' => apply_filters( 'wc_stripe_allow_prepaid_card', true ) ? 'yes' : 'no',
416
  ),
417
  'nonce' => array(
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WooCommerce Stripe Payment Gateway ===
2
  Contributors: automattic, royho, akeda, mattyza, bor0, woothemes
3
- Tags: credit card, stripe, woocommerce
4
  Requires at least: 4.4
5
  Tested up to: 4.9
6
  Requires PHP: 5.6
7
- Stable tag: 4.0.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
@@ -101,171 +101,13 @@ If you get stuck, you can ask for help in the Plugin Forum.
101
 
102
  == Changelog ==
103
 
104
- = 4.0.2 - 2018-01-17 =
105
- * Add - 3DS support on Stripe Checkout ( Modal Popup ).
106
- * Add - Filter to enable Payment Request Button on Checkout 'wc_stripe_show_payment_request_on_checkout'.
107
- * Add - Filter to remove all fields from checkout validation. 'wc_stripe_validate_checkout_all_fields'.
108
- * Add - Filter to remove required fields from checkout validation. 'wc_stripe_validate_checkout_required_fields'.
109
- * Add - Custom error exceptions class.
110
- * Add - Credit card field names for clarity.
111
- * Fix - Possible conflicts with payment request totals when subscriptions is active.
112
- * Fix - Undefined notice on save card via subscriptions if card is deleted.
113
- * Fix - Error translation issue when 3DS is required.
114
- * Fix - Possible 404 if getting customer source if no id was found.
115
- * Fix - Add payment method was still available when save cards setting is disabled.
116
- * Fix - In certain cases when webhook is used, refunds can show as doubled when it is not.
117
- * Fix - Stripe checkout with bitcoin returns error on processing.
118
- * Tweak - Remove Sofort country selection in favor of using the billing country.
119
- * Tweak - Add payment page CSS styling.
120
- * Tweak - Error log to show full response object.
121
-
122
- = 4.0.1 - 2018-01-11 =
123
- * Fix - Add payment method conflict with terms and agreement page.
124
- * Fix - Checkout validation checkout field names/labels were not translated.
125
- * Fix - Card error translations.
126
- * Add - Deprecated Apple Pay Class to prevent errors.
127
-
128
- = 4.0.0 - 2018-01-08 =
129
- * Add - Stripe Elements Credit Card form for PCI compliance.
130
- * Add - Stripe Sources.
131
- * Add - SEPA Direct Debit.
132
- * Add - Bancontact.
133
- * Add - Giropay.
134
- * Add - Sofort.
135
- * Add - iDeal.
136
- * Add - Bitcoin.
137
- * Add - P24.
138
- * Add - Alipay.
139
-
140
- = 3.2.3 - 2017-08-23 =
141
- * Fix - Apple Pay action hook with wrong parameter causing errors.
142
-
143
- = 3.2.2 - 2017-07-10 =
144
- * Fix - Apple Pay button displaying in non Safari browser.
145
- * Fix - Apple Pay with coupon not applying to total.
146
-
147
- = 3.2.1 =
148
- * Fix - Discounts were not applying to total with Apple Pay.
149
-
150
- = 3.2.0 =
151
- * Fix - Authorized first orders were not able to be refund.
152
- * Fix - Payment Request not honoring different shipping address in certain cases.
153
- * Fix - In certain Chrome versions, states are not abbreviated causing shipping validation issues with Payment Request API.
154
- * Add - Support for Dynamic Pricing.
155
-
156
- = 3.1.9 =
157
- * Fix - Handle a subscription renewal failed payment order correctly to prevent orders going into onhold status.
158
- * Fix - Auto accept terms for Payment Request API to prevent blocker for the checkout.
159
- * Fix - Add payment method via Stripe checkout button showed pricing.
160
- * Fix - When Stripe customer id is no longer linked to Stripe account, customer not found can happen.
161
- * Fix - On Subscription failed payment, new payment info not updating causing failed payments for recurring charges.
162
- * Add - Action hook to manipulate process response from API "wc_gateway_stripe_process_response".
163
- * Add - Apple Pay compatibility with WooCommerce Sequential Numbers Pro.
164
-
165
- = 3.1.8 =
166
- * Fix - Legacy < WC 3.0 stripe checkout file reference link name causing file not found.
167
-
168
- = 3.1.7 =
169
- * Fix - Additional WC 3.0 compatibility with subscriptions addons.
170
- * Fix - Retry failed subscription payments with customer ID.
171
- * Add - Site URL to metadata when charging subscription orders for reference.
172
-
173
- = 3.1.6 =
174
- * Fix - TypeError issues on single product page when using Apple Pay on Desktop.
175
- * Fix - In certain case, Apple Pay on single product page does not show shipping info.
176
- * Fix - Use store's base location to show/hide accepted credit cards instead of currency.
177
- * Fix - Unsupported product type when a variable product is added with Apple Pay.
178
-
179
- = 3.1.5 =
180
- * Add - Check for WP error object in domain verification.
181
-
182
- = 3.1.4 =
183
- * Tweak - If Apple Pay is not enabled, prevent Apple Pay Init.
184
- * Fix - Update for WooCommerce 3.0 compatibility.
185
- * Fix - Apple Pay on product detail page causes qty issue when using normal add to cart.
186
- * Fix - A partial workaround for UK/CA postal codes issue for shipping methods that support partial postal code estimates.
187
- * Fix - Stripe checkout did not validate properly formatted email address.
188
- * Fix - Error messages were not able to translate when validating checkout form.
189
- * Fix - Prevent payment gateway title logic ( Apple Pay ) from hijacking other payment methods.
190
- * Remove - Stripe Checkout allow remember me setting as it is redundant to saved card setting.
191
-
192
- = 3.1.3 =
193
- * Fix - When using Stripe Checkout, add payment method was disabled.
194
- * Fix - Possible non object type when using preview pages.
195
-
196
- = 3.1.2 =
197
- * Fix - Add payment method on My Account page error.
198
-
199
- = 3.1.1 =
200
- * Fix - Apple Pay error notice log link is incorrect.
201
- * Fix - Apple Pay domain verification paths check.
202
-
203
- = 3.1.0 =
204
- * New - Apple Pay Support.
205
- * New - Add Google Payment Request API.
206
- * New - Minimum PHP 5.6.
207
-
208
- = 3.0.7 =
209
- * New - Option to allow/disallow remember me on Stripe checkout modal.
210
- * Fix - Paying for order incorrectly uses cart amount.
211
- * Fix - Using WC function before checking exists causes fatal error.
212
-
213
- = 3.0.6 =
214
- * Fix - When adding declined cards, fatal error is thrown.
215
- * Fix - After a failed/declined process, valid cards are not accepted.
216
- * Fix - When paying via pay order page/link, billing info is not sent.
217
- * Fix - Account for all types of errors for proper localization.
218
- * Fix - Correctly reference Stripe fees/net based on Stripe account locale.
219
- * Fix - Bitcoin image not showing.
220
- * New - Introduce "wc_gateway_stripe_process_payment_error" action hook.
221
- * New - Introduce "wc_gateway_stripe_process_payment" action hook.
222
-
223
- = 3.0.5 =
224
- * Fix - Previous upload of files didn't take. Retry.
225
-
226
- = 3.0.4 =
227
- * Fix - Missing min files.
228
-
229
- = 3.0.3 =
230
- * Fix - Remove bitcoin icon when not using Stripe Checkout mode as it is not supported.
231
- * Fix - Failed payment order was not sending email to admin.
232
- * Fix - Saved card option was not being honored.
233
- * New - Filter for WC_Payment_Gateway_CC::wc_stripe_generate_payment_request return value.
234
- * New - Filter to disallow prepaid cards. "wc_stripe_allow_prepaid_card".
235
- * New - Filter to require billing address on Stripe Modal Checkout. "wc_stripe_checkout_require_billing_address".
236
- * New - Localized Stripe error messages.
237
-
238
- = 3.0.2 =
239
- * Fix - Set empty array as default value for first argument in WC_Stripe_Customer::create_customer
240
- * Tweak - Update default title to make it consistent with existing titles
241
-
242
- = 3.0.1 =
243
- * Backwards compatibility update to prevent error finding WC_Payment_Token_CC.
244
- * Added inline validation of keys.
245
-
246
- = 3.0.0 =
247
- * First public WordPress.org release.
248
- * Refactor for WC 2.6 and above. Legacy support for 2.5.
249
- * Improved saved card handling using tokenization API in WooCommerce.
250
 
251
  [See changelog for all versions](https://raw.githubusercontent.com/woothemes/woocommerce-gateway-stripe/master/changelog.txt).
252
 
253
  == Upgrade Notice ==
254
 
255
- = 4.0.2 =
256
- * Add - 3DS support on Stripe Checkout ( Modal Popup ).
257
- * Add - Filter to enable Payment Request Button on Checkout 'wc_stripe_show_payment_request_on_checkout'.
258
- * Add - Filter to remove all fields from checkout validation. 'wc_stripe_validate_checkout_all_fields'.
259
- * Add - Filter to remove required fields from checkout validation. 'wc_stripe_validate_checkout_required_fields'.
260
- * Add - Custom error exceptions class.
261
- * Add - Credit card field names for clarity.
262
- * Fix - Possible conflicts with payment request totals when subscriptions is active.
263
- * Fix - Undefined notice on save card via subscriptions if card is deleted.
264
- * Fix - Error translation issue when 3DS is required.
265
- * Fix - Possible 404 if getting customer source if no id was found.
266
- * Fix - Add payment method was still available when save cards setting is disabled.
267
- * Fix - In certain cases when webhook is used, refunds can show as doubled when it is not.
268
- * Fix - Stripe checkout with bitcoin returns error on processing.
269
- * Tweak - Remove Sofort country selection in favor of using the billing country.
270
- * Tweak - Add payment page CSS styling.
271
- * Tweak - Error log to show full response object.
1
  === WooCommerce Stripe Payment Gateway ===
2
  Contributors: automattic, royho, akeda, mattyza, bor0, woothemes
3
+ Tags: credit card, stripe, apple pay, payment request, google pay, sepa, sofort, bancontact, alipay, giropay, ideal, bitcoin, p24, woocommerce, automattic
4
  Requires at least: 4.4
5
  Tested up to: 4.9
6
  Requires PHP: 5.6
7
+ Stable tag: 4.0.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
101
 
102
  == Changelog ==
103
 
104
+ = 4.0.3 - 2018-01-18 =
105
+ * Fix - Pass Stripe source as id instead of object as some sites may conflict with objects being passed.
106
+ * Fix - For Payment Request Button, if test keys are not filled, it can cause live mode not to function.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  [See changelog for all versions](https://raw.githubusercontent.com/woothemes/woocommerce-gateway-stripe/master/changelog.txt).
109
 
110
  == Upgrade Notice ==
111
 
112
+ = 4.0 =
113
+ 4.0 is a major update. Please do a full site backup and test on a staging site before deploying to a live/production server.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
woocommerce-gateway-stripe.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
- * Version: 4.0.2
9
  * Requires at least: 4.4
10
  * Tested up to: 4.9
11
  * WC requires at least: 2.6
@@ -22,7 +22,7 @@ if ( ! class_exists( 'WC_Stripe' ) ) :
22
  /**
23
  * Required minimums and constants
24
  */
25
- define( 'WC_STRIPE_VERSION', '4.0.2' );
26
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
27
  define( 'WC_STRIPE_MIN_WC_VER', '2.6.0' );
28
  define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
+ * Version: 4.0.3
9
  * Requires at least: 4.4
10
  * Tested up to: 4.9
11
  * WC requires at least: 2.6
22
  /**
23
  * Required minimums and constants
24
  */
25
+ define( 'WC_STRIPE_VERSION', '4.0.3' );
26
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
27
  define( 'WC_STRIPE_MIN_WC_VER', '2.6.0' );
28
  define( 'WC_STRIPE_MAIN_FILE', __FILE__ );