# Paystack Client (Rust)
A lightweight, async Rust client for interacting with the [Paystack API](https://paystack.com/docs/api/).
This crate provides helpers for **initializing** and **verifying** payments using `reqwest` and `tokio`.
---
## ✨ Features
- Initialize a Paystack payment
- Generate unique payment references
- Verify payment status
- Async-first (`tokio` + `reqwest`)
---
## Instalation
```bash
cargo add paystack-client
```
## Usage
#### `initialize payment`
```rust
use 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 payment`
```rust
use 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);
}
```