⭐ Installing
dependencies:
binance_pay: ^0.0.3
⚡ Import
import 'package:binance_pay/binance_pay.dart';
📙 How To Use
BinancePay pay = BinancePay(
apiKey: apiKey,
apiSecretKey: apiSecret,
);
Create an order
Returns OrderResponse
String merchantTradeNo = generateMerchantTradeNo();
//Create an order
OrderResponse response = await pay.createOrder(
body: RequestBody(
merchantTradeNo: merchantTradeNo,
orderAmount: '1.01',
currency: 'BUSD',
goodsType: '01',
goodsCategory: '1000',
referenceGoodsId: '1234567',
goodsName: 'Cup Cake',
goodsDetail: 'A Yummy cup cake.',
),
);
Query the order
Returns QueryResponse
//Query the order
QueryResponse queryResponse = await pay.queryOrder(
merchantTradeNo: merchantTradeNo,
prepayId: response.data!.prepayId,
);
Close the order
Returns CloseResponse
//Close the order
CloseResponse closeResponse = await pay.closeOrder(
merchantTradeNo: merchantTradeNo,
);