rust_paystack/
lib.rs

1//! # Rust Paystack
2//!
3//! A Rust library for interacting with the Paystack API.
4//!
5//! ## Getting Started
6//! Run this command in your project directory:
7//! ```rust,no_run
8//! cargo add rust_paystack
9//! cargo add rust_decimal_macros // for parsing the amount
10//! ```
11//!
12//! ## Including the Library in Your Project
13//! ```rust,no_run
14//! use rust_paystack::Paystack;
15//! ```
16//!
17//! ## Creating a New Instance
18//! When creating a new instance, the API key should be passed as a string:
19//! ```rust,no_run
20//! let rust_p = RustPaystack::new("sk_xxxxxxxxxx".to_string());
21//! ```
22//!
23//! ## Initializing a Transaction
24//! ```rust,no_run
25//! use rust_paystack::Paystack;
26//! use rust_decimal_macros::dec;
27//!
28//! #[tokio::main]
29//! async fn main() {
30//!     let rust_p = RustPaystack::new("sk_xxxxxxxxxx".to_string());
31//!
32//!     let amount = dec!(10.50); // Amount should be parsed using rust_decimal_macros
33//!     let email = "test@testmail.com";
34//!
35//!     let response = rust_p.initialize_transaction(email, amount).await;
36//!
37//!     println!("{:?}", response);
38//! }
39//! ```
40//!
41//! ## Verifying a Transaction
42//! ```rust,no_run
43//! use rust_paystack::Paystack;
44//!
45//! #[tokio::main]
46//! async fn main() {
47//!     let rust_p = RustPaystack::new("sk_xxxxxxxxxx".to_string());
48//!     let response = rust_p.verify_payment("reference").await;
49//!
50//!     println!("{:?}", response);
51//! }
52//! ```
53
54mod payment;
55
56pub use payment::RustPaystack;