openlibx402-client
HTTP client library for the X402 payment protocol with automatic and explicit payment handling.
This library provides both high-level (automatic) and low-level (explicit) APIs for interacting with X402-enabled services.
Features
- X402Client: Explicit control over payment requests and responses
- X402AutoClient: Automatic payment handling with configurable payment limits and retry logic
- Full HTTP Support: GET and POST requests with transparent payment integration
- Error Handling: Proper error types for payment failures and network issues
- Async/Await: Built on Tokio for non-blocking operations
Quick Start
Add to your Cargo.toml:
[]
= "0.0.1"
= { = "1.35", = ["full"] }
Automatic Payment (Recommended)
use ;
use Keypair;
async
Explicit Payment Control
use X402Client;
use Keypair;
async
Configuration
AutoClientOptions
Documentation
For full documentation, visit: https://openlibx402.github.io/docs
License
MIT License - See LICENSE file for details.
Related Packages
openlibx402-core- Core protocol libraryopenlibx402-rocket- Rocket server integrationopenlibx402-actix- Actix Web server integration