paystack-rs

CI paystack-rs on crates.io paystack-rs  on docs.rs

Convenient Async rust bindings and types for the Paystack HTTP API aiming to support the entire API surface. Not the case? Please open an issue. I update the definitions on a weekly basis.

Documentation

See the Rust API docs or the examples.

Installation

paystack-rs uses the reqwest http client under the hood and the tokio runtime for async operations.

toml [dependencies] paystack-rs = "0.1"

You can also download the source code and use in your code base directly if you prefer.

Usage

Initalizing an instance of the Paystack client and creating a transaction.

```rust use std::env; use dotenv::dotenv; use paystack::{PaystackClient, TransactionBuilder, PaystackError};

#[tokio::main]
async fn main() -> Result<(), PaystackError>{
    dotenv().ok()
    let api_key = env::var("PAYSTACK_API_KEY").unwrap();
    let client = PaystackClient::new(api_key);

    let body = TransactionBuilder::new()
        .email("email@example.com")
        .amount("200000")
        .currency("NGN")
        .build()
        .unwrap();

    let transaction = client
        .initialize_transaction(body)
        .await
        .expect("Unable to create transaction");

    Ok(())
}

```

Contributing

See CONTRIBUTING.md for information on contributing to paystack-rs.

License

Licensed under MIT license (LICENSE-MIT).