diff --git a/plugins/woocommerce/changelog/45979-frosso-patch-1 b/plugins/woocommerce/changelog/45979-frosso-patch-1 new file mode 100644 index 00000000000..a85211a9220 --- /dev/null +++ b/plugins/woocommerce/changelog/45979-frosso-patch-1 @@ -0,0 +1,4 @@ +Significance: patch +Type: tweak + +refactor: `woocommerce_rest_checkout_process_payment_error` returns a `400` response code, instead of `402`. \ No newline at end of file diff --git a/plugins/woocommerce/src/StoreApi/Utilities/CheckoutTrait.php b/plugins/woocommerce/src/StoreApi/Utilities/CheckoutTrait.php index 865ee511f8b..d811207d54b 100644 --- a/plugins/woocommerce/src/StoreApi/Utilities/CheckoutTrait.php +++ b/plugins/woocommerce/src/StoreApi/Utilities/CheckoutTrait.php @@ -85,7 +85,7 @@ trait CheckoutTrait { throw new RouteException( 'woocommerce_rest_checkout_invalid_payment_result', __( 'Invalid payment result received from payment method.', 'woocommerce' ), 500 ); } } catch ( \Exception $e ) { - throw new RouteException( 'woocommerce_rest_checkout_process_payment_error', $e->getMessage(), 402 ); + throw new RouteException( 'woocommerce_rest_checkout_process_payment_error', esc_html( $e->getMessage() ), 400 ); } }