TypeScript SDK
PaymentArgs
Configuration object for verifying or processing X402 payments.
type PaymentArgs = { facilitator: ReturnType<typeof facilitatorType>; method: "GET" | "POST" | ({} & string); network: FacilitatorNetwork; paymentData?: string | null; price: Money | ERC20TokenAmount; resourceUrl: string; routeConfig?: PaymentMiddlewareConfig;};
The payment facilitator instance used to verify and settle payments
type facilitator = ReturnType<typeof facilitatorType>;
The HTTP method used to access the resource
type method = "GET" | "POST" | ({} & string);
The blockchain network where the payment should be processed
type network = FacilitatorNetwork;
The payment data/proof provided by the client, typically from the X-PAYMENT header
type paymentData = string | null;
The wallet address that should receive the payment
The price for accessing the resource - either a USD amount (e.g., "$0.10") or a specific token amount
type price = Money | ERC20TokenAmount;
The URL of the resource being protected by the payment
type resourceUrl = string;
Optional configuration for the payment middleware route
type routeConfig = PaymentMiddlewareConfig;