From 3c9f4a9697e1bce50b5373f40e38abd70f75477b Mon Sep 17 00:00:00 2001 From: Alex Florisca Date: Wed, 5 Oct 2022 10:50:05 +0100 Subject: [PATCH] Return 424 instead of 400 when checkout payment fails (#7273) * Return 424 instead of 400 when checkout payment fails * Change status for 424 to 402 --- src/StoreApi/Routes/V1/Checkout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StoreApi/Routes/V1/Checkout.php b/src/StoreApi/Routes/V1/Checkout.php index c7dac9c0236..5a5112edf84 100644 --- a/src/StoreApi/Routes/V1/Checkout.php +++ b/src/StoreApi/Routes/V1/Checkout.php @@ -518,7 +518,7 @@ private function process_payment( \WP_REST_Request $request, PaymentResult $paym throw new RouteException( 'woocommerce_rest_checkout_invalid_payment_result', __( 'Invalid payment result received from payment method.', 'woo-gutenberg-products-block' ), 500 ); } } catch ( \Exception $e ) { - throw new RouteException( 'woocommerce_rest_checkout_process_payment_error', $e->getMessage(), 400 ); + throw new RouteException( 'woocommerce_rest_checkout_process_payment_error', $e->getMessage(), 402 ); } }