Skip to content

Interface: X402PaymentRequiredResponse<TRequirements> ​

Defined in: packages/x402-core/src/types/requirements.ts:179

The x402 v2 PaymentRequired object a 402 Payment Required answers with: one resource, and the ways to pay for it. The client picks one of accepts[], pays it, and retries the request with the PAYMENT-SIGNATURE header.

The HTTP transport carries it base64-encoded in the PAYMENT-REQUIRED response header (encodePaymentRequiredHeader). The merchant middleware sends it as the body too, with a details string beside it.

Generic over the accepts[] element (TRequirements) so a mixed-scheme offer (e.g. canton-exact + a bridge scheme) is expressible as a union; every other field is shared. Generic → type-only.

Type Parameters ​

TRequirements ​

TRequirements = CantonPaymentRequirements

Properties ​

accepts ​

ts
accepts: TRequirements[];

Defined in: packages/x402-core/src/types/requirements.ts:184

Payment options; the client satisfies exactly one of them.


error? ​

ts
error?: string;

Defined in: packages/x402-core/src/types/requirements.ts:186

Optional machine-readable reason, e.g. "payment_required".


extensions? ​

ts
extensions?: 
  | {
[key: string]: unknown;
}
  | null;

Defined in: packages/x402-core/src/types/requirements.ts:187


resource ​

ts
resource: object & object;

Defined in: packages/x402-core/src/types/requirements.ts:182

What is being paid for. Required by the spec.

Type Declaration ​

description? ​
ts
description?: string | null;
iconUrl? ​
ts
iconUrl?: string | null;
mimeType? ​
ts
mimeType?: string | null;
serviceName? ​
ts
serviceName?: string | null;
tags? ​
ts
tags?: string[] | null;
url ​
ts
url: string;

x402Version ​

ts
x402Version: 2;

Defined in: packages/x402-core/src/types/requirements.ts:180