Version Description
- Fix - Handle a subscription renewal failed payment order correctly to prevent orders going into onhold status.
- Fix - Auto accept terms for Payment Request API to prevent blocker for the checkout.
- Fix - Add payment method via Stripe checkout button showed pricing.
- Fix - When Stripe customer id is no longer linked to Stripe account, customer not found can happen.
- Fix - On Subscription failed payment, new payment info not updating causing failed payments for recurring charges.
- Add - Action hook to manipulate process response from API "wc_gateway_stripe_process_response".
- Add - Apple Pay compatibility with WooCommerce Sequential Numbers Pro.
Download this release
Release Info
Developer | royho |
Plugin | WooCommerce Stripe Payment Gateway |
Version | 3.1.9 |
Comparing to | |
See all releases |
Code changes from version 3.1.8 to 3.1.9
- includes/class-wc-gateway-stripe-addons.php +9 -2
- includes/class-wc-gateway-stripe.php +8 -5
- includes/class-wc-stripe-apple-pay.php +4 -2
- includes/class-wc-stripe-customer.php +8 -1
- includes/class-wc-stripe-payment-request.php +8 -3
- includes/legacy/class-wc-gateway-stripe.php +1 -1
- readme.txt +18 -3
- woocommerce-gateway-stripe.php +3 -3
includes/class-wc-gateway-stripe-addons.php
CHANGED
@@ -149,6 +149,8 @@ class WC_Gateway_Stripe_Addons extends WC_Gateway_Stripe {
|
|
149 |
'site_url' => esc_url( get_site_url() ),
|
150 |
);
|
151 |
$response = WC_Stripe_API::request( $request );
|
|
|
|
|
152 |
}
|
153 |
}
|
154 |
|
@@ -307,8 +309,13 @@ class WC_Gateway_Stripe_Addons extends WC_Gateway_Stripe {
|
|
307 |
* @return void
|
308 |
*/
|
309 |
public function update_failing_payment_method( $subscription, $renewal_order ) {
|
310 |
-
|
311 |
-
|
|
|
|
|
|
|
|
|
|
|
312 |
}
|
313 |
|
314 |
/**
|
149 |
'site_url' => esc_url( get_site_url() ),
|
150 |
);
|
151 |
$response = WC_Stripe_API::request( $request );
|
152 |
+
} else {
|
153 |
+
return $response; // Default catch all errors.
|
154 |
}
|
155 |
}
|
156 |
|
309 |
* @return void
|
310 |
*/
|
311 |
public function update_failing_payment_method( $subscription, $renewal_order ) {
|
312 |
+
if ( $this->wc_pre_30 ) {
|
313 |
+
update_post_meta( $subscription->id, '_stripe_customer_id', $renewal_order->stripe_customer_id );
|
314 |
+
update_post_meta( $subscription->id, '_stripe_card_id', $renewal_order->stripe_card_id );
|
315 |
+
} else {
|
316 |
+
$subscription->update_meta_data( '_stripe_customer_id', $renewal_order->get_meta( '_stripe_customer_id', true ) );
|
317 |
+
$subscription->update_meta_data( '_stripe_card_id', $renewal_order->get_meta( '_stripe_card_id', true ) );
|
318 |
+
}
|
319 |
}
|
320 |
|
321 |
/**
|
includes/class-wc-gateway-stripe.php
CHANGED
@@ -446,6 +446,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
446 |
|
447 |
if ( is_add_payment_method_page() ) {
|
448 |
$pay_button_text = __( 'Add Card', 'woocommerce-gateway-stripe' );
|
|
|
449 |
} else {
|
450 |
$pay_button_text = '';
|
451 |
}
|
@@ -553,10 +554,10 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
553 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
554 |
|
555 |
if ( $this->stripe_checkout ) {
|
556 |
-
wp_enqueue_script( 'stripe_checkout', 'https://checkout.stripe.com/
|
557 |
wp_enqueue_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe-checkout' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), array( 'stripe_checkout' ), WC_STRIPE_VERSION, true );
|
558 |
} else {
|
559 |
-
wp_enqueue_script( 'stripe', 'https://js.stripe.com/v2/', '', '
|
560 |
wp_enqueue_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), array( 'jquery-payment', 'stripe' ), WC_STRIPE_VERSION, true );
|
561 |
}
|
562 |
|
@@ -836,10 +837,10 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
836 |
|
837 |
// Store source in the order.
|
838 |
if ( $source->customer ) {
|
839 |
-
update_post_meta( $order_id, '_stripe_customer_id', $source->customer );
|
840 |
}
|
841 |
if ( $source->source ) {
|
842 |
-
update_post_meta( $order_id, '_stripe_card_id', $source->source );
|
843 |
}
|
844 |
}
|
845 |
|
@@ -873,7 +874,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
873 |
$this->log( 'Success: ' . $message );
|
874 |
|
875 |
} else {
|
876 |
-
|
877 |
|
878 |
if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
|
879 |
version_compare( WC_VERSION, '3.0.0', '<' ) ? $order->reduce_order_stock() : wc_reduce_stock_levels( $order_id );
|
@@ -883,6 +884,8 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway_CC {
|
|
883 |
$this->log( "Successful auth: $response->id" );
|
884 |
}
|
885 |
|
|
|
|
|
886 |
return $response;
|
887 |
}
|
888 |
|
446 |
|
447 |
if ( is_add_payment_method_page() ) {
|
448 |
$pay_button_text = __( 'Add Card', 'woocommerce-gateway-stripe' );
|
449 |
+
$total = '';
|
450 |
} else {
|
451 |
$pay_button_text = '';
|
452 |
}
|
554 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
555 |
|
556 |
if ( $this->stripe_checkout ) {
|
557 |
+
wp_enqueue_script( 'stripe_checkout', 'https://checkout.stripe.com/checkout.js', '', WC_STRIPE_VERSION, true );
|
558 |
wp_enqueue_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe-checkout' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), array( 'stripe_checkout' ), WC_STRIPE_VERSION, true );
|
559 |
} else {
|
560 |
+
wp_enqueue_script( 'stripe', 'https://js.stripe.com/v2/', '', '2.0', true );
|
561 |
wp_enqueue_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), array( 'jquery-payment', 'stripe' ), WC_STRIPE_VERSION, true );
|
562 |
}
|
563 |
|
837 |
|
838 |
// Store source in the order.
|
839 |
if ( $source->customer ) {
|
840 |
+
version_compare( WC_VERSION, '3.0.0', '<' ) ? update_post_meta( $order_id, '_stripe_customer_id', $source->customer ) : $order->update_meta_data( '_stripe_customer_id', $source->customer );
|
841 |
}
|
842 |
if ( $source->source ) {
|
843 |
+
version_compare( WC_VERSION, '3.0.0', '<' ) ? update_post_meta( $order_id, '_stripe_card_id', $source->source ) : $order->update_meta_data( '_stripe_card_id', $source->source );
|
844 |
}
|
845 |
}
|
846 |
|
874 |
$this->log( 'Success: ' . $message );
|
875 |
|
876 |
} else {
|
877 |
+
update_post_meta( $order_id, '_transaction_id', $response->id, true );
|
878 |
|
879 |
if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
|
880 |
version_compare( WC_VERSION, '3.0.0', '<' ) ? $order->reduce_order_stock() : wc_reduce_stock_levels( $order_id );
|
884 |
$this->log( "Successful auth: $response->id" );
|
885 |
}
|
886 |
|
887 |
+
do_action( 'wc_gateway_stripe_process_response', $response, $order );
|
888 |
+
|
889 |
return $response;
|
890 |
}
|
891 |
|
includes/class-wc-stripe-apple-pay.php
CHANGED
@@ -279,7 +279,7 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
|
|
279 |
'key' => $this->publishable_key,
|
280 |
'currency_code' => get_woocommerce_currency(),
|
281 |
'country_code' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
|
282 |
-
'label' => $this->statement_descriptor,
|
283 |
'ajaxurl' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
|
284 |
'stripe_apple_pay_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_nonce' ),
|
285 |
'stripe_apple_pay_cart_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_cart_nonce' ),
|
@@ -316,7 +316,7 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
|
|
316 |
'key' => $this->publishable_key,
|
317 |
'currency_code' => get_woocommerce_currency(),
|
318 |
'country_code' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
|
319 |
-
'label' => $this->statement_descriptor,
|
320 |
'ajaxurl' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
|
321 |
'stripe_apple_pay_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_nonce' ),
|
322 |
'stripe_apple_pay_cart_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_cart_nonce' ),
|
@@ -1121,6 +1121,8 @@ class WC_Stripe_Apple_Pay extends WC_Gateway_Stripe {
|
|
1121 |
// If we got here, the order was created without problems!
|
1122 |
wc_transaction_query( 'commit' );
|
1123 |
|
|
|
|
|
1124 |
return $order;
|
1125 |
}
|
1126 |
|
279 |
'key' => $this->publishable_key,
|
280 |
'currency_code' => get_woocommerce_currency(),
|
281 |
'country_code' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
|
282 |
+
'label' => $this->statement_descriptor . ' (via WooCommerce)',
|
283 |
'ajaxurl' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
|
284 |
'stripe_apple_pay_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_nonce' ),
|
285 |
'stripe_apple_pay_cart_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_cart_nonce' ),
|
316 |
'key' => $this->publishable_key,
|
317 |
'currency_code' => get_woocommerce_currency(),
|
318 |
'country_code' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
|
319 |
+
'label' => $this->statement_descriptor . ' (via WooCommerce)',
|
320 |
'ajaxurl' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
|
321 |
'stripe_apple_pay_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_nonce' ),
|
322 |
'stripe_apple_pay_cart_nonce' => wp_create_nonce( '_wc_stripe_apple_pay_cart_nonce' ),
|
1121 |
// If we got here, the order was created without problems!
|
1122 |
wc_transaction_query( 'commit' );
|
1123 |
|
1124 |
+
do_action( 'woocommerce_checkout_update_order_meta', $order_id, array() );
|
1125 |
+
|
1126 |
return $order;
|
1127 |
}
|
1128 |
|
includes/class-wc-stripe-customer.php
CHANGED
@@ -181,7 +181,14 @@ class WC_Stripe_Customer {
|
|
181 |
), 'customers/' . $this->get_id() . '/sources' );
|
182 |
|
183 |
if ( is_wp_error( $response ) ) {
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
$this->create_customer();
|
186 |
return $this->add_card( $token, false );
|
187 |
} else {
|
181 |
), 'customers/' . $this->get_id() . '/sources' );
|
182 |
|
183 |
if ( is_wp_error( $response ) ) {
|
184 |
+
// It is possible the WC user once was linked to a customer on Stripe
|
185 |
+
// but no longer exists. Instead of failing, lets try to create a
|
186 |
+
// new customer.
|
187 |
+
if ( preg_match( '/No such customer:/', $response->get_error_message() ) ) {
|
188 |
+
delete_user_meta( $this->get_user_id(), '_stripe_customer_id' );
|
189 |
+
$this->create_customer();
|
190 |
+
return $this->add_card( $token, false );
|
191 |
+
} elseif ( 'customer' === $response->get_error_code() && $retry ) {
|
192 |
$this->create_customer();
|
193 |
return $this->add_card( $token, false );
|
194 |
} else {
|
includes/class-wc-stripe-payment-request.php
CHANGED
@@ -162,9 +162,12 @@ class WC_Stripe_Payment_Request {
|
|
162 |
WC()->customer->set_shipping_to_base();
|
163 |
}
|
164 |
|
165 |
-
version_compare( WC_VERSION, '3.0', '<' )
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
168 |
|
169 |
$packages = array();
|
170 |
|
@@ -291,6 +294,8 @@ class WC_Stripe_Payment_Request {
|
|
291 |
if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
|
292 |
define( 'WOOCOMMERCE_CHECKOUT', true );
|
293 |
}
|
|
|
|
|
294 |
|
295 |
WC()->checkout()->process_checkout();
|
296 |
|
162 |
WC()->customer->set_shipping_to_base();
|
163 |
}
|
164 |
|
165 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
166 |
+
WC()->customer->calculated_shipping( true );
|
167 |
+
} else {
|
168 |
+
WC()->customer->set_calculated_shipping( true );
|
169 |
+
WC()->customer->save();
|
170 |
+
}
|
171 |
|
172 |
$packages = array();
|
173 |
|
294 |
if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
|
295 |
define( 'WOOCOMMERCE_CHECKOUT', true );
|
296 |
}
|
297 |
+
|
298 |
+
$_POST['terms'] = 1;
|
299 |
|
300 |
WC()->checkout()->process_checkout();
|
301 |
|
includes/legacy/class-wc-gateway-stripe.php
CHANGED
@@ -519,7 +519,7 @@ class WC_Gateway_Stripe extends WC_Payment_Gateway {
|
|
519 |
$order->payment_complete( $response->id );
|
520 |
WC_Stripe::log( "Successful charge: $response->id" );
|
521 |
} else {
|
522 |
-
|
523 |
|
524 |
if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
|
525 |
$order->reduce_order_stock();
|
519 |
$order->payment_complete( $response->id );
|
520 |
WC_Stripe::log( "Successful charge: $response->id" );
|
521 |
} else {
|
522 |
+
update_post_meta( $order->id, '_transaction_id', $response->id, true );
|
523 |
|
524 |
if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
|
525 |
$order->reduce_order_stock();
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, mikejolley, akeda, royho, mattyza, slash1an
|
|
3 |
Tags: credit card, stripe, woocommerce
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.7.2
|
6 |
-
Stable tag: 3.1.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -95,6 +95,15 @@ If you get stuck, you can ask for help in the Plugin Forum.
|
|
95 |
|
96 |
== Changelog ==
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
= 3.1.8 =
|
99 |
* Fix - Legacy < WC 3.0 stripe checkout file reference link name causing file not found.
|
100 |
|
@@ -185,5 +194,11 @@ If you get stuck, you can ask for help in the Plugin Forum.
|
|
185 |
|
186 |
== Upgrade Notice ==
|
187 |
|
188 |
-
= 3.1.
|
189 |
-
* Fix -
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Tags: credit card, stripe, woocommerce
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.7.2
|
6 |
+
Stable tag: 3.1.9
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
95 |
|
96 |
== Changelog ==
|
97 |
|
98 |
+
= 3.1.9 =
|
99 |
+
* Fix - Handle a subscription renewal failed payment order correctly to prevent orders going into onhold status.
|
100 |
+
* Fix - Auto accept terms for Payment Request API to prevent blocker for the checkout.
|
101 |
+
* Fix - Add payment method via Stripe checkout button showed pricing.
|
102 |
+
* Fix - When Stripe customer id is no longer linked to Stripe account, customer not found can happen.
|
103 |
+
* Fix - On Subscription failed payment, new payment info not updating causing failed payments for recurring charges.
|
104 |
+
* Add - Action hook to manipulate process response from API "wc_gateway_stripe_process_response".
|
105 |
+
* Add - Apple Pay compatibility with WooCommerce Sequential Numbers Pro.
|
106 |
+
|
107 |
= 3.1.8 =
|
108 |
* Fix - Legacy < WC 3.0 stripe checkout file reference link name causing file not found.
|
109 |
|
194 |
|
195 |
== Upgrade Notice ==
|
196 |
|
197 |
+
= 3.1.9 =
|
198 |
+
* Fix - Handle a subscription renewal failed payment order correctly to prevent orders going into onhold status.
|
199 |
+
* Fix - Auto accept terms for Payment Request API to prevent blocker for the checkout.
|
200 |
+
* Fix - Add payment method via Stripe checkout button showed pricing.
|
201 |
+
* Fix - When Stripe customer id is no longer linked to Stripe account, customer not found can happen.
|
202 |
+
* Fix - On Subscription failed payment, new payment info not updating causing failed payments for recurring charges.
|
203 |
+
* Add - Action hook to manipulate process response from API "wc_gateway_stripe_process_response".
|
204 |
+
* Add - Apple Pay compatibility with WooCommerce Sequential Numbers Pro.
|
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: 3.1.
|
9 |
* Text Domain: woocommerce-gateway-stripe
|
10 |
* Domain Path: /languages
|
11 |
*
|
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
32 |
/**
|
33 |
* Required minimums and constants
|
34 |
*/
|
35 |
-
define( 'WC_STRIPE_VERSION', '3.1.
|
36 |
define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
|
37 |
define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
|
38 |
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
|
@@ -157,7 +157,7 @@ if ( ! class_exists( 'WC_Stripe' ) ) :
|
|
157 |
* or the environment changes after activation. Also handles upgrade routines.
|
158 |
*/
|
159 |
public function check_environment() {
|
160 |
-
if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( '
|
161 |
$this->install();
|
162 |
|
163 |
do_action( 'woocommerce_stripe_updated' );
|
5 |
* Description: Take credit card payments on your store using Stripe.
|
6 |
* Author: WooCommerce
|
7 |
* Author URI: https://woocommerce.com/
|
8 |
+
* Version: 3.1.9
|
9 |
* Text Domain: woocommerce-gateway-stripe
|
10 |
* Domain Path: /languages
|
11 |
*
|
32 |
/**
|
33 |
* Required minimums and constants
|
34 |
*/
|
35 |
+
define( 'WC_STRIPE_VERSION', '3.1.9' );
|
36 |
define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
|
37 |
define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
|
38 |
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
|
157 |
* or the environment changes after activation. Also handles upgrade routines.
|
158 |
*/
|
159 |
public function check_environment() {
|
160 |
+
if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) {
|
161 |
$this->install();
|
162 |
|
163 |
do_action( 'woocommerce_stripe_updated' );
|