| Crates.io | fly402-core |
| lib.rs | fly402-core |
| version | 0.0.3 |
| created_at | 2025-11-01 07:28:37.828432+00 |
| updated_at | 2025-11-01 07:28:37.828432+00 |
| description | Core library for the X402 payment protocol with Solana blockchain integration |
| homepage | https://github.com/SerPepe/402fly |
| repository | https://github.com/fly402/fly402 |
| max_upload_size | |
| id | 1911783 |
| size | 164,214 |
Core library for the X402 payment protocol with Solana blockchain integration.
X402 is an open standard that enables autonomous payments for API access using HTTP 402 "Payment Required" status codes and Solana micropayments.
Add to your Cargo.toml:
[dependencies]
402fly-core = "0.0.1"
use 402fly_core::{PaymentRequest, Fly402Config};
let request = PaymentRequest::new(
"0.10", // amount in USDC
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC mint
"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU", // payment address
)
.with_description("Premium API access");
// Send to client (typically as HTTP 402 response body)
let json = request.to_json()?;
use 402fly_core::SolanaPaymentProcessor;
use solana_sdk::signer::keypair::Keypair;
let processor = SolanaPaymentProcessor::new(
"https://api.devnet.solana.com".to_string(),
None
);
let result = processor.create_payment(&payment_request, &keypair).await?;
println!("Transaction: {}", result);
For full documentation, visit: https://402fly.github.io/docs
MIT License - See LICENSE file for details.
402fly-client - HTTP client with automatic payment handling402fly-rocket - Rocket web framework integration402fly-actix - Actix Web framework integration