Expand description
§Rust Paystack
a rust library for interacting with Paystack API
§Getting Started
run this command in your project directory
cargo add rust_paystackIncluding the library in your project:
use rust_paystack::Paystack;§Creating a new instance
when creating a new instance, api key should be parsed to string
let rust_p = RustPaystack::new(PAYSTACK_SECRET_KEY.to_string());§Initializing a transaction
#[tokio::main]
async fn main() {
let rust_p = RustPaystack::new(PAYSTACK_SECRET_KEY.to_string());
let req = rust_p.initialize_transaction( "test@testmail.com", 10.50).await;
println!("{:?}", req);
}§Verfiying a transaction
#[tokio::main]
async fn main() {
let rust_p = RustPaystack::new(PAYSTACK_SECRET_KEY.to_string());
let req = rust_p.verify_payment("reference").await;
println!("{:?}", req);
}