Skip to content

Function: encodePaymentRequiredHeader() ​

ts
function encodePaymentRequiredHeader<TRequirements>(paymentRequired): string;

Defined in: packages/x402-core/src/payment-header.ts:59

Serialise a 402's PaymentRequired into a PAYMENT-REQUIRED response header value: base64 of its UTF-8 JSON, as the x402 v2 HTTP transport carries it and as PAYMENT-SIGNATURE carries a payment. Generic so any scheme's accepts[] can be encoded.

Type Parameters ​

TRequirements ​

TRequirements

Parameters ​

paymentRequired ​

X402PaymentRequiredResponse<TRequirements>

Returns ​

string