Crate paystack_transaction

Source
Expand description

§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();
}

Structs§

MobileMoney
Mobile money object data
Payment
Data wrapper for payment ready to send for initialization
PaymentBuilder
Building blocks for initiating a Paystack Payment
VerificationData

Enums§

AuthError
Authentication Error types
Currency
Supported Currencies
ResponseError
Response Error wrapping error response from Paystack API

Traits§

Verify
Verify transactions

Functions§

cred_from_env
Helper function that looks for Secret Key from your .env file and returns a Secret<String>.
expose_secret
Helper for unmasking Secret wrapper
verify_transaction
Verify the status of a transaction, given the reference of the transaction

Type Aliases§

VerificationResult