5 releases

0.1.4 Oct 21, 2023
0.1.3 Oct 16, 2023
0.1.2 Oct 16, 2023
0.1.1 Oct 16, 2023
0.1.0 Oct 16, 2023

#201 in Finance

34 downloads per month

MIT/Apache

18KB
321 lines

Paystack Transaction

A Simple package to use Paystack with Rust

Usage

#[tokio::main]
async fn main() {
    let key = cred_from_env("SECRET_KEY".to_string()).unwrap();

    let mut builder = Payment::builder(
        "test@example.com".to_string(),
        100.0,
        key,
    );

    builder.mobile_money(
        MobileMoney {
           phone: "08123456789".to_string(),
           provider: "MTN".to_string(),
        }
    );
    builder.label("label".to_string());
    builder.reference("reference".to_string());

    builder.build().send().await.unwrap();
}

Installation

[dependencies]
paystack-transaction = "0.1.2"

lib.rs:

Paystack Transaction

A Simple to use package to use Paystack with Rust

Usage

use paystack_transaction::{cred_from_env, PaymentBuilder, Payment, MobileMoney};

async fn build() {
    let key = cred_from_env("SECRET_KEY".to_string()).unwrap();

    let mut builder = Payment::builder(
        "test@example.com".to_string(),
        100.0,
        key,
    );

    builder.mobile_money(
        MobileMoney {
           phone: "08123456789".to_string(),
           provider: "MTN".to_string(),
        }
    );
    builder.label("label".to_string());
    builder.reference("reference".to_string());

    builder.build().send().await.unwrap();
}

Dependencies

~4–20MB
~234K SLoC