Qwery SDK for Rust
Rust SDK for integrating Qwery x402 Payment Facilitator into your applications.

Installation
Add this to your Cargo.toml:
[dependencies]
qwery-sdk = "0.1"
tokio = { version = "1.0", features = ["full"] }
Quick Start
use qwery_sdk::{QweryClient, PaymentRequest, Network};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = QweryClient::new(Network::Mainnet)?;
let payment = client.create_payment(PaymentRequest {
amount: 0.01,
token: "SOL".to_string(),
recipient: "merchant_wallet_address".to_string(),
metadata: None,
}).await?;
println!("Payment ID: {}", payment.payment_id);
println!("Transaction: {}", payment.transaction);
Ok(())
}
Features
- Zero User Fees - Facilitator pays network costs
- Instant Settlement - Sub-2 second transaction finality
- Multi-Token Support - SOL, USDC, USDT on Solana
- Type-Safe - Full Rust type safety
- Async/Await - Built on Tokio for async operations
Examples
Sign and Settle Payment
use qwery_sdk::{QweryClient, PaymentRequest, Network};
use solana_sdk::signature::Keypair;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = QweryClient::new(Network::Devnet)?;
let keypair = Keypair::new();
let payment = client.create_payment(PaymentRequest {
amount: 0.01,
token: "SOL".to_string(),
recipient: "recipient_address".to_string(),
metadata: None,
}).await?;
let result = client.sign_and_settle(&payment, &keypair).await?;
if result.success {
println!("Payment settled! Signature: {:?}", result.signature);
}
Ok(())
}
Verify Payment
use qwery_sdk::{QweryClient, Network};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = QweryClient::new(Network::Mainnet)?;
let result = client.verify_payment("transaction_signature").await?;
println!("Verified: {}", result.verified);
println!("Status: {}", result.status);
Ok(())
}
Health Check
use qwery_sdk::{QweryClient, Network};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = QweryClient::new(Network::Mainnet)?;
let health = client.health().await?;
println!("Status: {}", health.status);
println!("Version: {}", health.version);
Ok(())
}
Documentation
License
MIT © Qwery