--- /stripe-payments/includes/class-asp-process-ipn-ng.php +++ /wp-content/plugins/stripe-payments/includes/class-asp-process-ipn-ng.php @@ -101,11 +101,11 @@ if ( ! empty( $post_data ) ) { $this->post_data = $post_data; } - + do_action( 'asp_ng_before_payment_processing', $post_data ); $this->sess = ASP_Session::get_instance(); - + $post_thankyou_page_url = $this->get_post_var( 'asp_thankyou_page_url', FILTER_SANITIZE_STRING ); $this->asp_redirect_url = empty( $post_thankyou_page_url ) ? $this->asp_class->get_setting( 'checkout_url' ) : base64_decode( $post_thankyou_page_url ); //phpcs:ignore @@ -155,7 +155,16 @@ $is_live = $this->get_post_var( 'asp_is_live', FILTER_VALIDATE_BOOLEAN ); ASP_Utils::load_stripe_lib(); - $key = $is_live ? $this->asp_class->APISecKey : $this->asp_class->APISecKeyTest; + $settings = (array) get_option('wfs-bcf-asp-settings'); + if ($prod_id == $settings['asp_product_id']) { + if ($is_live) { + $key = $settings['api_secret_key']; + } else { + $key = $settings['api_secret_key_test']; + } + } else { + $key = $is_live ? $this->asp_class->APISecKey : $this->asp_class->APISecKeyTest; + } \Stripe\Stripe::setApiKey( $key ); $api = ASP_Stripe_API::get_instance(); @@ -165,7 +174,7 @@ ASP_Debug_Logger::log( 'Firing asp_ng_process_ipn_payment_data_item_override filter.' ); $p_data = apply_filters( 'asp_ng_process_ipn_payment_data_item_override', false, $pi ); - + if ( false === $p_data ) { $p_data = new ASP_Payment_Data( $pi ); }