Overview
x402x is the core package of the x402x protocol, extending the x402 core with foundational types for EIP-3009, EIP-2612, and Permit2, Zod schemas, EVM utilities, and verification logic. It’s typically used indirectly by higher-level packages (x402x-fetch / x402x-server / x402x-facilitator / x402x-detector), but can also be imported directly when you need custom orchestration.
Capabilities
- Types and Zod schemas:
PaymentRequirements,PaymentPayload,Response402, etc. - EVM utilities: EIP-2612 Permit, EIP-3009, and Permit2 signing and verification
- Validation logic: amount/network/signature/nonce checks
- Modular design: shared, schemes, client, verify, facilitator, types
Install
Modules and exports
When to use directly
- Import base types/utilities when you need custom verification or orchestration
- When building a facilitator
Types and schemas (example)
Usage examples
Create a 402 response
EVM utilities
Best practices
- Use Zod schemas to validate external inputs at runtime
- Leverage type inference to reduce manual type maintenance
- Import modules on demand to avoid bundling everything
Relationship to other packages
- fetch: generates payment headers and retry logic; depends on core types
- server: orchestrates creation/verification/settlement; depends on verification and types
- facilitator: defines payment processing interfaces and return types
- detector: depends on a small subset of EVM/type utilities
Resources
- Source:
https://github.com/WTFLabs-WTF/x402x/tree/main/typescript/packages/x402x - Standards: EIP-2612, EIP-3009, Permit2