SealedOptionalbody: unknownOptionalurl: stringOptionalmethod: stringOptionalheaders: HeadersOptional ReadonlybodyThe full parsed JSON response body, when available.
Optional ReadonlycodeApplication error code from the response body, if present.
E.g. "INSUFFICIENT_FUNDS", "CALL_EXCEPTION".
Optional ReadonlyheadersRaw response headers, when available — e.g. to read PAYMENT-REQUIRED off a 402.
Optional ReadonlymethodThe HTTP method (e.g. GET, POST), when available.
OptionalstackReadonlystatusHTTP status code (e.g. 500, 404).
Optional ReadonlyurlThe request URL, when available.
Thrown when an API request returns a 402 Payment Required status. Carries the raw response headers/body needed to build an x402 payment — hand
getHeaderand.bodystraight tox402HTTPClient.getPaymentRequiredResponse.This is a subclass of ApiError and is thrown automatically whenever
new ApiError(402, body)is constructed. Callers can catch it either as anApiError(withstatus === 402) or specifically asPaymentRequiredError.See
Fees for how to provide a payer or pre-sign a payment