paystack-client

Crates.iopaystack-client
lib.rspaystack-client
version0.1.2
created_at2025-08-18 12:47:38.862492+00
updated_at2025-08-23 18:32:23.553756+00
descriptionA simple Rust client for Paystack payments (initialize & verify).
homepage
repositoryhttps://github.com/anomalous254/paystack-client
max_upload_size
id1800420
size50,304
am_request (anomalous254)

documentation

https://docs.rs/paystack-client

README

Paystack Client (Rust)

A lightweight, async Rust client for interacting with the Paystack 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

cargo add paystack-client

Usage

initialize payment

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

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);
}
Commit count: 5

cargo fmt