Skip to content

Easepay Software Development Kit in Rust programming language

License

Notifications You must be signed in to change notification settings

Easepay/easepay-sdk-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easepay Rust SDK

Description

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.

Getting Started

  1. Create an account on Easepay
  2. Create an API key on the API settings page
  3. Install the SDK using npm
cargo add @easepay/sdk
  1. 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

Usage

The SDK provides a simple interface for making requests to the Easepay API. The following methods are available:

  • createPayment: Create a new payment
  • getPayment: Get a payment by ID
  • getPayments: Get a list of payments
  • createPayout: Create a new payout
  • getPayout: Get a payout by ID
  • getPayouts: Get a list of payouts

Building locally

  • 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

License

This project is licensed under the MIT License - see the Licesnse file for details

About

Easepay Software Development Kit in Rust programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages