binance-pay-rs

Unofficial Rust Library for the Binance Pay API

Quickstart

Make sure the following env variables are set: - BINANCE_PAY_API_KEY - BINANCE_PAY_API_SECRET

In your Cargo.toml file toml [dependencies] binance-pay-rs = "^0" tokio = { version = "1.18.0", features = ["rt-multi-thread", "macros"] }

Example

```rust use bpay::api::createorder::{ Currency, Env, Goods, GoodsCategory, GoodsType, Order, TerminalType, }; use bpay::api::Binance; use bpay::client::Client; use bpay::utils::createnonce; use tokio;

[tokio::main]

async fn main() {

let order = Order { env: Env { terminaltype: TerminalType::Web, }, merchanttradeno: createnonce(10), orderamount: 10.0, currency: Currency::USDT, goods: Goods { goodstype: GoodsType::VirtualGoods, goodscategory: GoodsCategory::Electronics, referencegoodsid: "sku1234".into(), goodsname: "Laptop".into(), goods_detail: None, }, };

let mut client = Client::fromenv(); let createorderresult = order.post(&client).await.unwrap(); match createorderresult.terminaltype { TerminalType::Web => assert!(true), _ => assert!(false), } } ```

To run an example:

sh cargo run --example notification_axum_server

Roadmap