Easepay Rust SDK is a library that allows you to easily interact with the Easepay API in a Rust application. It provides a simple and easy-to-use interface for the Easepay API. The SDK is built on top of the Axios library and provides a simple interface for making requests to the Easepay API.
- Create an account on Easepay
- Create an API key on the API settings page
- Install the SDK using npm
cargo add @easepay/sdk
- Use the SDK to interact with the Easepay API
use easepay::{Easepay, Currency};
use std::env;
#[tokio::main]
async fn main() {
let easepay =
Easepay::new(env::var("EASEPAY_API_KEY").unwrap(),
env::var("EASEPAY_API_SECRET").unwrap());
let response = easepay.create_payment(
31550,
Currency::NGN,
"https://example.com/redirect",
"https://example.com/callback",
Some("50193eb8-40ba-4280-b6e4-7077f7f5626e"),
Some("6614c062-cbf5-47a0-911e-8e3d30e1c900"),
).await;
match response {
Ok(payment) => {
println!("Payment created: {:?}", payment);
}
Err(error) => {
println!("Error creating payment: {:?}", error);
}
}
}
For test and development purposes, you can use the test API key and secret provided in the API settings page
The SDK provides a simple interface for making requests to the Easepay API. The following methods are available:
createPayment
: Create a new paymentgetPayment
: Get a payment by IDgetPayments
: Get a list of paymentscreatePayout
: Create a new payoutgetPayout
: Get a payout by IDgetPayouts
: Get a list of payouts
- Clone the repository
git clone https://github.com/easepay/easepay-sdk-rust.git
- Install dependencies
cargo build
- Run the example
cargo run --example create_payment
- Run tests
cargo test
This project is licensed under the MIT License - see the Licesnse file for details