| Crates.io | paystack-client |
| lib.rs | paystack-client |
| version | 0.1.2 |
| created_at | 2025-08-18 12:47:38.862492+00 |
| updated_at | 2025-08-23 18:32:23.553756+00 |
| description | A simple Rust client for Paystack payments (initialize & verify). |
| homepage | |
| repository | https://github.com/anomalous254/paystack-client |
| max_upload_size | |
| id | 1800420 |
| size | 50,304 |
A lightweight, async Rust client for interacting with the Paystack API.
This crate provides helpers for initializing and verifying payments using reqwest and tokio.
tokio + reqwest)cargo add paystack-client
initialize paymentuse paystack_client::PaystackClient;
#[tokio::main]
async fn main() {
// Replace with your own test/secret key
let api = PaystackClient::new("sk_test_xxx");
let (reference, response) = api.initialize_payment(
"test@example.com",
5000.0, // amount in Naira (₦5000.0 -> 500000 kobo)
"http://localhost/callback",
)
.await
.expect("Failed to initialize payment");
println!("Generated reference: {}", reference);
println!("Paystack response: {:#?}", response);
}
verify paymentuse paystack_client::PaystackClient;
#[tokio::main]
async fn main() {
let api = PaystackClient::new("sk_test_xxx");
let reference = "SOME-UNIQUE-REFERENCE";
let verification = api.verify_payment(reference)
.await
.expect("Failed to verify payment");
println!("Verification result: {:#?}", verification);
}