Unofficial Rust Library for the Binance Pay API
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"] }
```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;
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), } } ```
sh
cargo run --example notification_axum_server
[x] v0.2.1
[ ] v0.2.2
src/c2b/webhook/verification
src/c2b/webhook/notification
[ ] v0.3.0