Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.faremeter.xyz/llms.txt

Use this file to discover all available pages before exploring further.

x402

Type Aliases

x402PaymentId

x402PaymentId = typeof x402PaymentId.infer
Defined in: packages/types/src/x402.ts:15

x402PaymentPayload

x402PaymentPayload = typeof x402PaymentPayload.infer
Defined in: packages/types/src/x402.ts:76

x402PaymentRequiredResponse

x402PaymentRequiredResponse = typeof x402PaymentRequiredResponse.infer
Defined in: packages/types/src/x402.ts:39

x402PaymentRequiredResponseLenient

x402PaymentRequiredResponseLenient = typeof x402PaymentRequiredResponseLenient.infer
Defined in: packages/types/src/x402.ts:53

x402PaymentRequirements

x402PaymentRequirements = typeof x402PaymentRequirements.infer
Defined in: packages/types/src/x402.ts:23

x402SettleRequest

x402SettleRequest = typeof x402SettleRequest.infer
Defined in: packages/types/src/x402.ts:138

x402SettleResponse

x402SettleResponse = typeof x402SettleResponse.infer
Defined in: packages/types/src/x402.ts:162

x402SettleResponseLegacy

x402SettleResponseLegacy = typeof x402SettleResponseLegacy.infer
Defined in: packages/types/src/x402.ts:148

x402SettleResponseLenient

x402SettleResponseLenient = typeof x402SettleResponseLenient.infer
Defined in: packages/types/src/x402.ts:177

x402SupportedKind

x402SupportedKind = typeof x402SupportedKind.infer
Defined in: packages/types/src/x402.ts:211

x402SupportedResponse

x402SupportedResponse = typeof x402SupportedResponse.infer
Defined in: packages/types/src/x402.ts:220

x402VerifyRequest

x402VerifyRequest = typeof x402VerifyRequest.infer
Defined in: packages/types/src/x402.ts:91

x402VerifyResponse

x402VerifyResponse = typeof x402VerifyResponse.infer
Defined in: packages/types/src/x402.ts:99

x402VerifyResponseLenient

x402VerifyResponseLenient = typeof x402VerifyResponseLenient.infer
Defined in: packages/types/src/x402.ts:112

Variables

X_PAYMENT_HEADER

const X_PAYMENT_HEADER: "X-PAYMENT" = "X-PAYMENT"
Defined in: packages/types/src/x402.ts:8 HTTP header name for v1 client payment payloads.

X_PAYMENT_RESPONSE_HEADER

const X_PAYMENT_RESPONSE_HEADER: "X-PAYMENT-RESPONSE" = "X-PAYMENT-RESPONSE"
Defined in: packages/types/src/x402.ts:13 HTTP header name for v1 server payment responses.

x402PaymentHeaderToPayload

const x402PaymentHeaderToPayload: Type<(In) => To, { }>
Defined in: packages/types/src/x402.ts:86

x402PaymentId

const x402PaymentId: Type<{ asset: string; network: string; scheme: string; }, { }>
Defined in: packages/types/src/x402.ts:15

x402PaymentPayload

const x402PaymentPayload: Type<{ asset?: string; network: string; payload: object; scheme: string; x402Version: number; }, { }>
Defined in: packages/types/src/x402.ts:76

x402PaymentRequiredResponse

const x402PaymentRequiredResponse: Type<{ accepts: object[]; error: string; x402Version: number; }, { }>
Defined in: packages/types/src/x402.ts:39

x402PaymentRequiredResponseLenient

const x402PaymentRequiredResponseLenient: Type<{ accepts: object[]; error?: string; x402Version: number; }, { }>
Defined in: packages/types/src/x402.ts:53 Lenient payment required response parser that accepts optional error field. Use this when parsing incoming data from older servers that may not include the error field.

x402PaymentRequirements

const x402PaymentRequirements: Type<{ asset: string; description: string; extra?: object; maxAmountRequired: string; maxTimeoutSeconds: number; mimeType?: string; network: string; outputSchema?: object; payTo: string; resource: string; scheme: string; }, { }>
Defined in: packages/types/src/x402.ts:23

x402SettleRequest

const x402SettleRequest: Type<{ paymentHeader?: string; paymentPayload?: { asset?: string; network: string; payload: object; scheme: string; x402Version: number; }; paymentRequirements: { asset: string; description: string; extra?: object; maxAmountRequired: string; maxTimeoutSeconds: number; mimeType?: string; network: string; outputSchema?: object; payTo: string; resource: string; scheme: string; }; }, { }> = x402VerifyRequest
Defined in: packages/types/src/x402.ts:138

x402SettleResponse

const x402SettleResponse: Type<{ errorReason?: string; network: string; payer: string; success: boolean; transaction: string; }, { }>
Defined in: packages/types/src/x402.ts:162 Spec-compliant settle response per x402-specification-v1.md Section 5.3. Field names: transaction, network, errorReason (not txHash, networkId, error)

x402SettleResponseLegacy

const x402SettleResponseLegacy: Type<{ error?: null | string; networkId: null | string; payer?: string; success: boolean; txHash: null | string; }, { }>
Defined in: packages/types/src/x402.ts:148 Legacy settle response type with pre-spec field names (txHash, networkId, error). Use x402SettleResponse for spec-compliant field names (transaction, network, errorReason). This type exists for backward compatibility when interfacing with older clients that use legacy field names.

x402SettleResponseLenient

const x402SettleResponseLenient: Type<{ error?: null | string; errorReason?: null | string; network?: null | string; networkId?: null | string; payer?: string; success: boolean; transaction?: null | string; txHash?: null | string; }, { }>
Defined in: packages/types/src/x402.ts:177 Lenient settle response parser that accepts either legacy or spec-compliant field names. Use this when parsing incoming data that may come from older clients using legacy field names.

x402SupportedKind

const x402SupportedKind: Type<{ extra?: object; network: string; scheme: string; x402Version: number; }, { }>
Defined in: packages/types/src/x402.ts:211

x402SupportedResponse

const x402SupportedResponse: Type<{ kinds: object[]; }, { }>
Defined in: packages/types/src/x402.ts:220

x402VerifyRequest

const x402VerifyRequest: Type<{ paymentHeader?: string; paymentPayload?: { asset?: string; network: string; payload: object; scheme: string; x402Version: number; }; paymentRequirements: { asset: string; description: string; extra?: object; maxAmountRequired: string; maxTimeoutSeconds: number; mimeType?: string; network: string; outputSchema?: object; payTo: string; resource: string; scheme: string; }; }, { }>
Defined in: packages/types/src/x402.ts:91

x402VerifyResponse

const x402VerifyResponse: Type<{ invalidReason?: string; isValid: boolean; payer: string; }, { }>
Defined in: packages/types/src/x402.ts:99

x402VerifyResponseLenient

const x402VerifyResponseLenient: Type<{ invalidReason?: null | string; isValid: boolean; payer?: string; }, { }>
Defined in: packages/types/src/x402.ts:112 Lenient verify response parser that accepts optional payer field. Use this when parsing incoming data from older facilitators that may not include the payer field.

Functions

generateRequirementsMatcher()

generateRequirementsMatcher(scheme, network, asset): object
Defined in: packages/types/src/x402.ts:237 Creates a matcher function for filtering payment requirements. The matcher performs case-insensitive matching on scheme, network, and asset fields.

Parameters

scheme
string[] Accepted payment scheme names
network
string[] Accepted network identifiers
asset
string[] Accepted asset addresses

Returns

object Object with the matcher tuple and isMatchingRequirement function
isMatchingRequirement()
isMatchingRequirement: (req) => boolean
Parameters
req
asset
string = ...
network
string = ...
scheme
string = ...
Returns
boolean
matchTuple
matchTuple: Type<{ asset: (In) => To; network: (In) => To; scheme: (In) => To; }, { }>

normalizePaymentRequiredResponse()

normalizePaymentRequiredResponse(res): object
Defined in: packages/types/src/x402.ts:66 Normalize a lenient payment required response to spec-compliant field values. Defaults error to empty string when missing.

Parameters

res
accepts
object[] = ...
error?
string = "string"
x402Version
number = "number.integer"

Returns

object
accepts
accepts: object[]
error
error: string = "string"
x402Version
x402Version: number = "number.integer"

normalizeSettleResponse()

normalizeSettleResponse(res): object
Defined in: packages/types/src/x402.ts:195 Normalize a lenient settle response to spec-compliant field names. Converts legacy field names (txHash, networkId, error) to spec-compliant names (transaction, network, errorReason).

Parameters

res
error?
null | string = “string | null”
errorReason?
null | string = “string | null”
network?
null | string = “string | null”
networkId?
null | string = “string | null”
payer?
string = "string"
success
boolean = "boolean"
transaction?
null | string = “string | null”
txHash?
null | string = “string | null”

Returns

object
errorReason?
optional errorReason: string = "string"
network
network: string = "string"
payer
payer: string = "string"
success
success: boolean = "boolean"
transaction
transaction: string = "string"

normalizeVerifyResponse()

normalizeVerifyResponse(res): object
Defined in: packages/types/src/x402.ts:124 Normalize a lenient verify response to spec-compliant field values. Defaults payer to empty string and strips null from invalidReason.

Parameters

res
invalidReason?
null | string = “string | null”
isValid
boolean = "boolean"
payer?
string = "string"

Returns

object
invalidReason?
optional invalidReason: string = "string"
isValid
isValid: boolean = "boolean"
payer
payer: string = "string"