eclipse-vertx/vert.x · error

402 Payment Required

Error message

402 Payment Required

What it means

Constant defining the 402 Payment Required response expectation: applying it via expecting(...) turns a 402 response into a failed request future. 402 is reserved for payment schemes; the 'message' is the reason reported in the expectation failure.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/http/HttpResponseExpectation.java:160

  /**
   * Any 4XX client error
   */
  HttpResponseExpectation SC_CLIENT_ERRORS = status(400, 500);

  /**
   * 400 Bad Request
   */
  HttpResponseExpectation SC_BAD_REQUEST = status(400);

  /**
   * 401 Unauthorized
   */
  HttpResponseExpectation SC_UNAUTHORIZED = status(401);

  /**
   * 402 Payment Required
   */
  HttpResponseExpectation SC_PAYMENT_REQUIRED = status(402);

  /**
   * 403 Forbidden
   */
  HttpResponseExpectation SC_FORBIDDEN = status(403);

  /**
   * 404 Not Found
   */
  HttpResponseExpectation SC_NOT_FOUND = status(404);

  /**
   * 405 Method Not Allowed
   */
  HttpResponseExpectation SC_METHOD_NOT_ALLOWED = status(405);

  /**
   * 406 Not Acceptable

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Handle the failure according to your payment flow
  2. Use a custom expectation if 402 is a normal outcome in your protocol
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/http/HttpResponseExpectation.java:160 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/63bc1bf8c0bdcfb6. Report an issue: GitHub.