2 releases
0.1.1 | Jul 25, 2020 |
---|---|
0.1.0 | Jul 25, 2020 |
#5 in #charge
11KB
99 lines
Paystack
Introduction
Paystack Package for Rust
Usage
Install Package
paystack = "0.1.1"
- Initialise Paystack
pub async fn main() -> Result<(), Error> {
let _paystack = Paystack::new("sk_test_00000000000000000000000000000".to_string());
Ok(())
}
...
NOTE
Ensure you pass your paystack secret key
- Initiate charge
...
pub async fn main() -> Result<(), Error> {
let transaction = paystack.initialize("adebayo@emmanuel.com".to_string(), "5000".to_string()).await;
println!("{:#?}", transaction);
Ok(())
}
- Verify charge
...
pub async fn main() -> Result<(), Error> {
let verify = paystack.verify_payment("xxxxxxxx".to_string()).await;
println!("{:#?}", verify);
Ok(())
}
- Charge charge
...
pub async fn main() -> Result<(), Error> {
let charge_card = paystack.charge_card("AUTH_xxxxx".to_string(), "a@a.com".to_string(), "5000".to_string()).await;
println!("{:#?}", charge_card);
Ok(())
}
NOTE
Check theexample
directory to see a sample implementation
Contribution
Please contribute
Dependencies
~7–11MB
~201K SLoC