Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter Sumit P

    (@sumit_p)

    I am thinking of modifying <em>includes/class-wc-stripe-order-handler.php</em> file and make following changes in process_redirect_payment method.

    OLD:

    catch ( WC_Stripe_Exception $e ) {
            WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
    
            do_action( 'wc_gateway_stripe_process_redirect_payment_error', $e, $order );
    
            /* translators: error message */
            $order->update_status( 'failed', sprintf( __( 'Stripe payment failed: %s', 'woocommerce-gateway-stripe' ), $e->getLocalizedMessage() ) );
    
            wc_add_notice( $e->getLocalizedMessage(), 'error' );
            wp_safe_redirect( wc_get_checkout_url() );
            exit;
    }
    

    NEW:

    
    catch ( WC_Stripe_Exception $e ) {
            WC_Stripe_Logger::log( 'Error: ' . $e->getMessage() );
    
            do_action( 'wc_gateway_stripe_process_redirect_payment_error', $e, $order );
    
            /* translators: error message */
            $order->update_status( 'failed', sprintf( __( 'Stripe payment failed: %s', 'woocommerce-gateway-stripe' ), $e->getLocalizedMessage() ) );
    }
    

    Last three lines from old catch blocks are removed

    After making these changes, user stays on Order Received (aka Thank you) page and it shows message, ‘Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.’ Below this message it shows two buttons i.e. My Account and Pay.

    I am open for better options because I know there is a risk of changes getting wiped out when a plugin is updated in the future. Also, let me know if there are any other potential problems/risks with this solution.

Viewing 1 replies (of 1 total)