Rust bindings for Kuda HTTP API
This repo contains the Kuda Bank SDK for Rust.
The SDK provides bindings to Kuda Bank REST API. You must add Tokio as a dependency within your Rust project to execute asynchronous code.
- Create a new Rust project:
cargo new sdk-example
- Add dependencies to kuda-rust and Tokio to your Cargo.toml file:
[dependencies]
kuda-rust = { git = "https://github.com/SeamPay/kuda-rust", tag = "v0.1.0" }
tokio = { version = "1", features = ["full"] }
- Make a request
use std::env;
use kuda::params::Response;
use kuda::{Client, VirtualAccount, VirtualAccountCreateRequest, VirtualAccountCreateResponseData};
#[tokio::main]
async fn main() -> Result<(), Error> {
let endpoint = env::var("KUDA_ENDPOINT").is_err();
let privatekey = env::var("KUDA_PRIVATEKEY").is_err();
let publickey = env::var("KUDA_PUBLICKEY").is_err();
let clientkey = env::var("KUDA_CLIENTKEY").is_err();
// create the client
let kuda_client = Client::new(
endpoint,
privatekey,
publickey,
clientkey,
);
// create the request
let request = VirtualAccountCreateRequest::new();
params.first_name = "Mark".to_string();
params.last_name = "Smith".to_string();
params.phone_number = "09039658058".to_string();
params.tracking_reference = "0012".to_string();
params.email = "example@email.com".to_string();
let resp = VirtualAccount::create_virtual_account(&kuda_client, request)
.await?;
println!("Response for creating virtual account: {:?}", resp);
Ok(())
}
In order to use the SDK, you must already have Rust and Cargo installed. If you don't, these instructions describe how to install Rust and Cargo.
-
Admin Account
- Get Admin Account Balance
- Get Admin Account Transaction History
- Get Admin Account Filtered Transaction History
- Enquire Bank Account
- Fund Transfer
- Check Transfer Status
-
Virtual Account
- Create Virtual Account
- Get Virtual Account
- Get Virtual Account Balance
- Get Virtual Account Transaction History
- Get Virtual Account Filtered Transaction History
- Fund Virtual Account
- Withdraw Virtual Account
- Fund Transfer Virtual Account
-
Banks
- List Banks