An asynchronous, type-safe Rust SDK for the Chapa payment gateway.
With chapa_rust, you integrate payments without worrying about raw HTTP
requests, JSON parsing, or error string matching. Instead, you get an
ergonomic, strongly-typed API designed for async Rust.
- Async, non-blocking requests (powered by [
tokio] and [reqwest]) - Idiomatic Rust builders and result types
- Typed error handling (no more guessing from error messages)
- Supports transactions, verification, transfers, subaccounts, and bank lookup
use chapa_rust::{Chapa, transaction::TransactionBuilder};
use chapa_rust::types::Currency;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let chapa = Chapa::new("your_api_key")?;
let tx = TransactionBuilder::new(100)
.currency(Currency::ETB)
.first_name("Abreham")
.last_name("Kassa")
.email("test@example.com")
.tx_ref("unique_ref")
.build();
let initialized = chapa.initialize(tx).await?;
println!("Payment URL: {}", initialized.data.checkout_url);
let verified = chapa.verify_transaction("unique_ref").await?;
println!("Verified: {:?}", verified.status);
Ok(())
}