WooCommerce Stripe Payment Gateway - Version 3.0.7

Version Description

  • New - Option to allow/disallow remember me on Stripe checkout modal.
  • Fix - Paying for order incorrectly uses cart amount.
  • Fix - Using WC function before checking exists causes fatal error.
Download this release

Release Info

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

Code changes from version 3.0.6 to 3.0.7

assets/js/stripe_checkout.js CHANGED
@@ -113,7 +113,7 @@ jQuery( function( $ ) {
113
 
114
  StripeCheckout.open({
115
  key : wc_stripe_params.key,
116
- billingAddress : 'yes' === wc_stripe_params.stripe_checkout_require_billing_address ? true : false,
117
  amount : $data.data( 'amount' ),
118
  name : $data.data( 'name' ),
119
  description : $data.data( 'description' ),
@@ -123,6 +123,7 @@ jQuery( function( $ ) {
123
  locale : $data.data( 'locale' ),
124
  email : $( '#billing_email' ).val() || $data.data( 'email' ),
125
  panelLabel : $data.data( 'panel-label' ),
 
126
  token : token_action,
127
  closed : wc_stripe_form.onClose()
128
  });
113
 
114
  StripeCheckout.open({
115
  key : wc_stripe_params.key,
116
+ billingAddress : 'yes' === wc_stripe_params.stripe_checkout_require_billing_address,
117
  amount : $data.data( 'amount' ),
118
  name : $data.data( 'name' ),
119
  description : $data.data( 'description' ),
123
  locale : $data.data( 'locale' ),
124
  email : $( '#billing_email' ).val() || $data.data( 'email' ),
125
  panelLabel : $data.data( 'panel-label' ),
126
+ allowRememberMe : $data.data( 'allow-remember-me' ),
127
  token : token_action,
128
  closed : wc_stripe_form.onClose()
129
  });
assets/js/stripe_checkout.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){"use strict";var b={init:function(b){this.form=b,this.stripe_submit=!1,a(this.form).on("click","#place_order",this.onSubmit).on("submit checkout_place_order_stripe"),a(document.body).on("checkout_error",this.resetModal)},isStripeChosen:function(){return a("#payment_method_stripe").is(":checked")&&(!a('input[name="wc-stripe-payment-token"]:checked').length||"new"===a('input[name="wc-stripe-payment-token"]:checked').val())},isStripeModalNeeded:function(c){var d,e=b.form.find("input.stripe_token");if(b.stripe_submit&&e)return!1;if(!b.isStripeChosen())return!1;if(1===a("input#terms").length&&0===a("input#terms:checked").length)return!1;if(a("#createaccount").is(":checked")&&a("#account_password").length&&""===a("#account_password").val())return!1;if(d=a(a("#ship-to-different-address-checkbox").is(":checked")?".woocommerce-billing-fields .validate-required, .woocommerce-shipping-fields .validate-required":".woocommerce-billing-fields .validate-required"),d.length){var f=!1;if(d.each(function(){""===a(this).find("input.input-text, select").not(a("#account_password, #account_username")).val()&&(f=!0)}),f)return!1}return!0},block:function(){b.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){b.form.unblock()},onClose:function(){b.unblock()},onSubmit:function(c){if(b.isStripeModalNeeded()){c.preventDefault();var d=b.form,e=a("#stripe-payment-data"),f=d.find("input.stripe_token");f.val("");var g=function(a){d.find("input.stripe_token").remove(),d.append('<input type="hidden" class="stripe_token" name="stripe_token" value="'+a.id+'"/>'),b.stripe_submit=!0,d.submit()};return StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address?!0:!1,amount:e.data("amount"),name:e.data("name"),description:e.data("description"),currency:e.data("currency"),image:e.data("image"),bitcoin:e.data("bitcoin"),locale:e.data("locale"),email:a("#billing_email").val()||e.data("email"),panelLabel:e.data("panel-label"),token:g,closed:b.onClose()}),!1}return!0},resetModal:function(){b.form.find("input.stripe_token").remove(),b.stripe_submit=!1}};b.init(a("form.checkout, form#order_review, form#add_payment_method"))});
1
+ jQuery(function(a){"use strict";var b={init:function(b){this.form=b,this.stripe_submit=!1,a(this.form).on("click","#place_order",this.onSubmit).on("submit checkout_place_order_stripe"),a(document.body).on("checkout_error",this.resetModal)},isStripeChosen:function(){return a("#payment_method_stripe").is(":checked")&&(!a('input[name="wc-stripe-payment-token"]:checked').length||"new"===a('input[name="wc-stripe-payment-token"]:checked').val())},isStripeModalNeeded:function(c){var d,e=b.form.find("input.stripe_token");if(b.stripe_submit&&e)return!1;if(!b.isStripeChosen())return!1;if(1===a("input#terms").length&&0===a("input#terms:checked").length)return!1;if(a("#createaccount").is(":checked")&&a("#account_password").length&&""===a("#account_password").val())return!1;if(d=a(a("#ship-to-different-address-checkbox").is(":checked")?".woocommerce-billing-fields .validate-required, .woocommerce-shipping-fields .validate-required":".woocommerce-billing-fields .validate-required"),d.length){var f=!1;if(d.each(function(){""===a(this).find("input.input-text, select").not(a("#account_password, #account_username")).val()&&(f=!0)}),f)return!1}return!0},block:function(){b.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){b.form.unblock()},onClose:function(){b.unblock()},onSubmit:function(c){if(b.isStripeModalNeeded()){c.preventDefault();var d=b.form,e=a("#stripe-payment-data"),f=d.find("input.stripe_token");f.val("");var g=function(a){d.find("input.stripe_token").remove(),d.append('<input type="hidden" class="stripe_token" name="stripe_token" value="'+a.id+'"/>'),b.stripe_submit=!0,d.submit()};return StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address,amount:e.data("amount"),name:e.data("name"),description:e.data("description"),currency:e.data("currency"),image:e.data("image"),bitcoin:e.data("bitcoin"),locale:e.data("locale"),email:a("#billing_email").val()||e.data("email"),panelLabel:e.data("panel-label"),allowRememberMe:e.data("allow-remember-me"),token:g,closed:b.onClose()}),!1}return!0},resetModal:function(){b.form.find("input.stripe_token").remove(),b.stripe_submit=!1}};b.init(a("form.checkout, form#order_review, form#add_payment_method"))});
includes/class-wc-gateway-stripe-addons.php CHANGED
@@ -99,9 +99,9 @@ class WC_Gateway_Stripe_Addons extends WC_Gateway_Stripe {
99
  * @param string $stripe_token (default: '')
100
  * @param bool initial_payment
101
  */
102
- public function process_subscription_payment( $order = '', $amount = 0 ) {
103
- if ( $amount * 100 < 50 ) {
104
- return new WP_Error( 'stripe_error', __( 'Sorry, the minimum allowed order total is 0.50 to use this payment method.', 'woocommerce-gateway-stripe' ) );
105
  }
106
 
107
  // Get source from order
@@ -146,8 +146,8 @@ class WC_Gateway_Stripe_Addons extends WC_Gateway_Stripe {
146
  try {
147
  $order = wc_get_order( $order_id );
148
 
149
- if ( $order->get_total() * 100 < 50 ) {
150
- throw new Exception( __( 'Sorry, the minimum allowed order total is 0.50 to use this payment method.', 'woocommerce-gateway-stripe' ) );
151
  }
152
 
153
  $source = $this->get_source( get_current_user_id(), true );
@@ -160,9 +160,6 @@ class WC_Gateway_Stripe_Addons extends WC_Gateway_Stripe {
160
  // Store source to order meta
161
  $this->save_source( $order, $source );
162
 
163
- // Reduce stock levels
164
- $order->reduce_order_stock();
165
-
166
  // Remove cart
167
  WC()->cart->empty_cart();
168
 
99
  * @param string $stripe_token (default: '')
100
  * @param bool initial_payment
101
  */
102
+ public function process_subscription_payment( $order = '', $amount = 0 ) {
103
+ if ( $amount * 100 < WC_Stripe::get_minimum_amount() ) {
104
+ return new WP_Error( 'stripe_error', sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe::get_minimum_amount() / 100 ) ) );
105
  }
106
 
107
  // Get source from order
146
  try {
147
  $order = wc_get_order( $order_id );
148
 
149
+ if ( $order->get_total() * 100 < WC_Stripe::get_minimum_amount() ) {
150
+ 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::get_minimum_amount() / 100 ) ) );
151
  }
152
 
153
  $source = $this->get_source( get_current_user_id(), true );
160
  // Store source to order meta
161
  $this->save_source( $order, $source );
162
 
 
 
 
163
  // Remove cart
164
  WC()->cart->empty_cart();
165
 
includes/class-wc-gateway-stripe.php CHANGED
@@ -66,6 +66,13 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
66
  */
67
  public $bitcoin;
68
 
 
 
 
 
 
 
 
69
  /**
70
  * Is test mode active?
71
  *
@@ -127,6 +134,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
127
  $this->publishable_key = $this->testmode ? $this->get_option( 'test_publishable_key' ) : $this->get_option( 'publishable_key' );
128
  $this->bitcoin = 'USD' === strtoupper( get_woocommerce_currency() ) && 'yes' === $this->get_option( 'stripe_bitcoin' );
129
  $this->logging = 'yes' === $this->get_option( 'logging' );
 
130
 
131
  if ( $this->stripe_checkout ) {
132
  $this->order_button_text = __( 'Continue to payment', 'woocommerce-gateway-stripe' );
@@ -248,11 +256,32 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
248
 
249
  wc_enqueue_js( "
250
  jQuery( function( $ ) {
251
- $( '#woocommerce_stripe_stripe_checkout' ).change(function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  if ( $( this ).is( ':checked' ) ) {
253
- $( '#woocommerce_stripe_stripe_checkout_locale, #woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image' ).closest( 'tr' ).show();
254
  } else {
255
- $( '#woocommerce_stripe_stripe_checkout_locale, #woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image' ).closest( 'tr' ).hide();
256
  }
257
  }).change();
258
 
@@ -287,6 +316,13 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
287
  public function payment_fields() {
288
  $user = wp_get_current_user();
289
  $display_tokenization = $this->supports( 'tokenization' ) && is_checkout() && $this->saved_cards;
 
 
 
 
 
 
 
290
 
291
  if ( $user->ID ) {
292
  $user_email = get_user_meta( $user->ID, 'billing_email', true );
@@ -306,12 +342,13 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
306
  data-panel-label="' . esc_attr( $pay_button_text ) . '"
307
  data-description=""
308
  data-email="' . esc_attr( $user_email ) . '"
309
- data-amount="' . esc_attr( $this->get_stripe_amount( WC()->cart->total ) ) . '"
310
  data-name="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '"
311
  data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '"
312
  data-image="' . esc_attr( $this->stripe_checkout_image ) . '"
313
  data-bitcoin="' . esc_attr( $this->bitcoin ? 'true' : 'false' ) . '"
314
- data-locale="' . esc_attr( $this->stripe_checkout_locale ? $this->stripe_checkout_locale : 'en' ) . '">';
 
315
 
316
  if ( $this->description ) {
317
  echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
@@ -557,9 +594,8 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
557
 
558
  // Handle payment.
559
  if ( $order->get_total() > 0 ) {
560
-
561
- if ( $order->get_total() * 100 < 50 ) {
562
- throw new Exception( __( 'Sorry, the minimum allowed order total is 0.50 to use this payment method.', 'woocommerce-gateway-stripe' ) );
563
  }
564
 
565
  WC_Stripe::log( "Info: Begin processing payment for order $order_id for the amount of {$order->get_total()}" );
66
  */
67
  public $bitcoin;
68
 
69
+ /**
70
+ * Alow Remember me setting for Stripe Checkout
71
+ *
72
+ * @var bool
73
+ */
74
+ public $allow_remember_me;
75
+
76
  /**
77
  * Is test mode active?
78
  *
134
  $this->publishable_key = $this->testmode ? $this->get_option( 'test_publishable_key' ) : $this->get_option( 'publishable_key' );
135
  $this->bitcoin = 'USD' === strtoupper( get_woocommerce_currency() ) && 'yes' === $this->get_option( 'stripe_bitcoin' );
136
  $this->logging = 'yes' === $this->get_option( 'logging' );
137
+ $this->allow_remember_me = 'yes' === $this->get_option( 'allow_remember_me', 'no' );
138
 
139
  if ( $this->stripe_checkout ) {
140
  $this->order_button_text = __( 'Continue to payment', 'woocommerce-gateway-stripe' );
256
 
257
  wc_enqueue_js( "
258
  jQuery( function( $ ) {
259
+ $( document.body ).on( 'change', '#woocommerce_stripe_testmode', function() {
260
+ var test_secret_key = $( '#woocommerce_stripe_test_secret_key' ).parents( 'tr' ).eq( 0 ),
261
+ test_publishable_key = $( '#woocommerce_stripe_test_publishable_key' ).parents( 'tr' ).eq( 0 ),
262
+ live_secret_key = $( '#woocommerce_stripe_secret_key' ).parents( 'tr' ).eq( 0 ),
263
+ live_publishable_key = $( '#woocommerce_stripe_publishable_key' ).parents( 'tr' ).eq( 0 );
264
+
265
+ if ( $( this ).is( ':checked' ) ) {
266
+ test_secret_key.show();
267
+ test_publishable_key.show();
268
+ live_secret_key.hide();
269
+ live_publishable_key.hide();
270
+ } else {
271
+ test_secret_key.hide();
272
+ test_publishable_key.hide();
273
+ live_secret_key.show();
274
+ live_publishable_key.show();
275
+ }
276
+ } );
277
+
278
+ $( '#woocommerce_stripe_testmode' ).change();
279
+
280
+ $( '#woocommerce_stripe_stripe_checkout' ).change( function() {
281
  if ( $( this ).is( ':checked' ) ) {
282
+ $( '#woocommerce_stripe_stripe_checkout_locale, #woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image, #woocommerce_stripe_allow_remember_me' ).closest( 'tr' ).show();
283
  } else {
284
+ $( '#woocommerce_stripe_stripe_checkout_locale, #woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image, #woocommerce_stripe_allow_remember_me' ).closest( 'tr' ).hide();
285
  }
286
  }).change();
287
 
316
  public function payment_fields() {
317
  $user = wp_get_current_user();
318
  $display_tokenization = $this->supports( 'tokenization' ) && is_checkout() && $this->saved_cards;
319
+ $total = WC()->cart->total;
320
+
321
+ // If paying from order, we need to get total from order not cart.
322
+ if ( isset( $_GET['pay_for_order'] ) && isset( $_GET['key'] ) ) {
323
+ $order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
324
+ $total = $order->get_total();
325
+ }
326
 
327
  if ( $user->ID ) {
328
  $user_email = get_user_meta( $user->ID, 'billing_email', true );
342
  data-panel-label="' . esc_attr( $pay_button_text ) . '"
343
  data-description=""
344
  data-email="' . esc_attr( $user_email ) . '"
345
+ data-amount="' . esc_attr( $this->get_stripe_amount( $total ) ) . '"
346
  data-name="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '"
347
  data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '"
348
  data-image="' . esc_attr( $this->stripe_checkout_image ) . '"
349
  data-bitcoin="' . esc_attr( $this->bitcoin ? 'true' : 'false' ) . '"
350
+ data-locale="' . esc_attr( $this->stripe_checkout_locale ? $this->stripe_checkout_locale : 'en' ) . '"
351
+ data-allow-remember-me="' . esc_attr( $this->allow_remember_me ? 'true' : 'false' ) . '">';
352
 
353
  if ( $this->description ) {
354
  echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
594
 
595
  // Handle payment.
596
  if ( $order->get_total() > 0 ) {
597
+ if ( $order->get_total() * 100 < WC_Stripe::get_minimum_amount() ) {
598
+ 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::get_minimum_amount() / 100 ) ) );
 
599
  }
600
 
601
  WC_Stripe::log( "Info: Begin processing payment for order $order_id for the amount of {$order->get_total()}" );
includes/legacy/class-wc-gateway-stripe.php CHANGED
@@ -441,9 +441,8 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway {
441
 
442
  // Handle payment
443
  if ( $order->get_total() > 0 ) {
444
-
445
- if ( $order->get_total() * 100 < 50 ) {
446
- throw new Exception( __( 'Sorry, the minimum allowed order total is 0.50 to use this payment method.', 'woocommerce-gateway-stripe' ) );
447
  }
448
 
449
  WC_Stripe::log( "Info: Begin processing payment for order $order_id for the amount of {$order->get_total()}" );
441
 
442
  // Handle payment
443
  if ( $order->get_total() > 0 ) {
444
+ if ( $order->get_total() * 100 < WC_Stripe::get_minimum_amount() ) {
445
+ 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::get_minimum_amount() / 100 ) ) );
 
446
  }
447
 
448
  WC_Stripe::log( "Info: Begin processing payment for order $order_id for the amount of {$order->get_total()}" );
includes/settings-stripe.php CHANGED
@@ -34,29 +34,29 @@ return apply_filters( 'wc_stripe_settings',
34
  'default' => 'yes',
35
  'desc_tip' => true,
36
  ),
37
- 'secret_key' => array(
38
- 'title' => __( 'Live Secret Key', 'woocommerce-gateway-stripe' ),
39
  'type' => 'text',
40
  'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
41
  'default' => '',
42
  'desc_tip' => true,
43
  ),
44
- 'publishable_key' => array(
45
- 'title' => __( 'Live Publishable Key', 'woocommerce-gateway-stripe' ),
46
  'type' => 'text',
47
  'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
48
  'default' => '',
49
  'desc_tip' => true,
50
  ),
51
- 'test_secret_key' => array(
52
- 'title' => __( 'Test Secret Key', 'woocommerce-gateway-stripe' ),
53
  'type' => 'text',
54
  'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
55
  'default' => '',
56
  'desc_tip' => true,
57
  ),
58
- 'test_publishable_key' => array(
59
- 'title' => __( 'Test Publishable Key', 'woocommerce-gateway-stripe' ),
60
  'type' => 'text',
61
  'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
62
  'default' => '',
@@ -78,6 +78,14 @@ return apply_filters( 'wc_stripe_settings',
78
  'default' => 'no',
79
  'desc_tip' => true,
80
  ),
 
 
 
 
 
 
 
 
81
  'stripe_checkout_locale' => array(
82
  'title' => __( 'Stripe Checkout locale', 'woocommerce-gateway-stripe' ),
83
  'type' => 'select',
@@ -88,13 +96,17 @@ return apply_filters( 'wc_stripe_settings',
88
  'options' => array(
89
  'auto' => __( 'Auto', 'woocommerce-gateway-stripe' ),
90
  'zh' => __( 'Simplified Chinese', 'woocommerce-gateway-stripe' ),
 
91
  'nl' => __( 'Dutch', 'woocommerce-gateway-stripe' ),
92
  'en' => __( 'English', 'woocommerce-gateway-stripe' ),
 
93
  'fr' => __( 'French', 'woocommerce-gateway-stripe' ),
94
  'de' => __( 'German', 'woocommerce-gateway-stripe' ),
95
  'it' => __( 'Italian', 'woocommerce-gateway-stripe' ),
96
  'ja' => __( 'Japanese', 'woocommerce-gateway-stripe' ),
 
97
  'es' => __( 'Spanish', 'woocommerce-gateway-stripe' ),
 
98
  ),
99
  ),
100
  'stripe_bitcoin' => array(
34
  'default' => 'yes',
35
  'desc_tip' => true,
36
  ),
37
+ 'test_secret_key' => array(
38
+ 'title' => __( 'Test Secret Key', 'woocommerce-gateway-stripe' ),
39
  'type' => 'text',
40
  'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
41
  'default' => '',
42
  'desc_tip' => true,
43
  ),
44
+ 'test_publishable_key' => array(
45
+ 'title' => __( 'Test Publishable Key', 'woocommerce-gateway-stripe' ),
46
  'type' => 'text',
47
  'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
48
  'default' => '',
49
  'desc_tip' => true,
50
  ),
51
+ 'secret_key' => array(
52
+ 'title' => __( 'Live Secret Key', 'woocommerce-gateway-stripe' ),
53
  'type' => 'text',
54
  'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
55
  'default' => '',
56
  'desc_tip' => true,
57
  ),
58
+ 'publishable_key' => array(
59
+ 'title' => __( 'Live Publishable Key', 'woocommerce-gateway-stripe' ),
60
  'type' => 'text',
61
  'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
62
  'default' => '',
78
  'default' => 'no',
79
  'desc_tip' => true,
80
  ),
81
+ 'allow_remember_me' => array(
82
+ 'title' => __( 'Allow Remember Me', 'woocommerce-gateway-stripe' ),
83
+ 'label' => __( 'Enable Remember Me', 'woocommerce-gateway-stripe' ),
84
+ 'type' => 'checkbox',
85
+ 'description' => __( 'If enabled, this option shows a "Remember Me" checkbox which when checked by the customer will persist their details.', 'woocommerce-gateway-stripe' ),
86
+ 'default' => 'yes',
87
+ 'desc_tip' => true,
88
+ ),
89
  'stripe_checkout_locale' => array(
90
  'title' => __( 'Stripe Checkout locale', 'woocommerce-gateway-stripe' ),
91
  'type' => 'select',
96
  'options' => array(
97
  'auto' => __( 'Auto', 'woocommerce-gateway-stripe' ),
98
  'zh' => __( 'Simplified Chinese', 'woocommerce-gateway-stripe' ),
99
+ 'da' => __( 'Danish', 'woocommerce-gateway-stripe' ),
100
  'nl' => __( 'Dutch', 'woocommerce-gateway-stripe' ),
101
  'en' => __( 'English', 'woocommerce-gateway-stripe' ),
102
+ 'fi' => __( 'Finnish', 'woocommerce-gateway-stripe' ),
103
  'fr' => __( 'French', 'woocommerce-gateway-stripe' ),
104
  'de' => __( 'German', 'woocommerce-gateway-stripe' ),
105
  'it' => __( 'Italian', 'woocommerce-gateway-stripe' ),
106
  'ja' => __( 'Japanese', 'woocommerce-gateway-stripe' ),
107
+ 'no' => __( 'Norwegian', 'woocommerce-gateway-stripe' ),
108
  'es' => __( 'Spanish', 'woocommerce-gateway-stripe' ),
109
+ 'sv' => __( 'Swedish', 'woocommerce-gateway-stripe' ),
110
  ),
111
  ),
112
  'stripe_bitcoin' => array(
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: automattic, woothemes, mikejolley, akeda, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, dsmithweb, fullysupportedphil, corsonr
3
  Tags: credit card, stripe, woocommerce
4
  Requires at least: 4.4
5
- Tested up to: 4.5
6
- Stable tag: 3.0.6
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -87,6 +87,11 @@ If you get stuck, you can ask for help in the Plugin Forum.
87
 
88
  == Changelog ==
89
 
 
 
 
 
 
90
  = 3.0.6 =
91
  * Fix - When adding declined cards, fatal error is thrown.
92
  * Fix - After a failed/declined process, valid cards are not accepted.
@@ -129,12 +134,7 @@ If you get stuck, you can ask for help in the Plugin Forum.
129
 
130
  == Upgrade Notice ==
131
 
132
- = 3.0.6 =
133
- * Fix - When adding declined cards, fatal error is thrown.
134
- * Fix - After a failed/declined process, valid cards are not accepted.
135
- * Fix - When paying via pay order page/link, billing info is not sent.
136
- * Fix - Account for all types of errors for proper localization.
137
- * Fix - Correctly reference Stripe fees/net based on Stripe account locale.
138
- * Fix - Bitcoin image not showing.
139
- * New - Introduce "wc_gateway_stripe_process_payment_error" action hook.
140
- * New - Introduce "wc_gateway_stripe_process_payment" action hook.
2
  Contributors: automattic, woothemes, mikejolley, akeda, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, dsmithweb, fullysupportedphil, corsonr
3
  Tags: credit card, stripe, woocommerce
4
  Requires at least: 4.4
5
+ Tested up to: 4.7.1
6
+ Stable tag: 3.0.7
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
87
 
88
  == Changelog ==
89
 
90
+ = 3.0.7 =
91
+ * New - Option to allow/disallow remember me on Stripe checkout modal.
92
+ * Fix - Paying for order incorrectly uses cart amount.
93
+ * Fix - Using WC function before checking exists causes fatal error.
94
+
95
  = 3.0.6 =
96
  * Fix - When adding declined cards, fatal error is thrown.
97
  * Fix - After a failed/declined process, valid cards are not accepted.
134
 
135
  == Upgrade Notice ==
136
 
137
+ = 3.0.7 =
138
+ * New - Option to allow/disallow remember me on Stripe checkout modal.
139
+ * Fix - Paying for order incorrectly uses cart amount.
140
+ * Fix - Using WC function before checking exists causes fatal error.
 
 
 
 
 
woocommerce-gateway-stripe.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: WooCommerce Stripe Gateway
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-gateway-stripe/
5
  * Description: Take credit card payments on your store using Stripe.
6
- * Author: Automattic
7
  * Author URI: https://woocommerce.com/
8
- * Version: 3.0.6
9
  * Text Domain: woocommerce-gateway-stripe
10
  * Domain Path: /languages
11
  *
12
- * Copyright (c) 2016 Automattic
13
  *
14
  * This program is free software: you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
32
  /**
33
  * Required minimums and constants
34
  */
35
- define( 'WC_STRIPE_VERSION', '3.0.6' );
36
  define( 'WC_STRIPE_MIN_PHP_VER', '5.3.0' );
37
  define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
38
  define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
@@ -224,7 +224,7 @@ class WC_Stripe {
224
  * @return string Setting link
225
  */
226
  public function get_setting_link() {
227
- $use_id_as_section = version_compare( WC()->version, '2.6', '>=' );
228
 
229
  $section_slug = $use_id_as_section ? 'stripe' : strtolower( 'WC_Gateway_Stripe' );
230
 
@@ -415,6 +415,49 @@ class WC_Stripe {
415
  $stripe_customer->set_default_card( $token->get_token() );
416
  }
417
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
418
 
419
  /**
420
  * What rolls down stairs
3
  * Plugin Name: WooCommerce Stripe Gateway
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-gateway-stripe/
5
  * Description: Take credit card payments on your store using Stripe.
6
+ * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
+ * Version: 3.0.7
9
  * Text Domain: woocommerce-gateway-stripe
10
  * Domain Path: /languages
11
  *
12
+ * Copyright (c) 2017 WooCommerce
13
  *
14
  * This program is free software: you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License as published by
32
  /**
33
  * Required minimums and constants
34
  */
35
+ define( 'WC_STRIPE_VERSION', '3.0.7' );
36
  define( 'WC_STRIPE_MIN_PHP_VER', '5.3.0' );
37
  define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
38
  define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
224
  * @return string Setting link
225
  */
226
  public function get_setting_link() {
227
+ $use_id_as_section = function_exists( 'WC' ) ? version_compare( WC()->version, '2.6', '>=' ) : false;
228
 
229
  $section_slug = $use_id_as_section ? 'stripe' : strtolower( 'WC_Gateway_Stripe' );
230
 
415
  $stripe_customer->set_default_card( $token->get_token() );
416
  }
417
  }
418
+
419
+ /**
420
+ * Checks Stripe minimum order value authorized per currency
421
+ */
422
+ public static function get_minimum_amount() {
423
+
424
+ // Check order amount
425
+ switch ( get_woocommerce_currency() ) {
426
+ case 'USD':
427
+ case 'CAD':
428
+ case 'EUR':
429
+ case 'CHF':
430
+ case 'AUD':
431
+ case 'SGD':
432
+ $minimum_amount = 50;
433
+ break;
434
+ case 'GBP':
435
+ $minimum_amount = 30;
436
+ break;
437
+ case 'DKK':
438
+ $minimum_amount = 250;
439
+ break;
440
+ case 'NOK':
441
+ case 'SEK':
442
+ $minimum_amount = 300;
443
+ break;
444
+ case 'JPY':
445
+ $minimum_amount = 5000;
446
+ break;
447
+ case 'MXN':
448
+ $minimum_amount = 1000;
449
+ break;
450
+ case 'HKD':
451
+ $minimum_amount = 400;
452
+ break;
453
+ default:
454
+ $minimum_amount = 50;
455
+ break;
456
+ }
457
+
458
+ return $minimum_amount;
459
+
460
+ }
461
 
462
  /**
463
  * What rolls down stairs