@foxses/pay-binance
v1.0.0
Published
Binance Pay payment provider for foxses-pay
Readme
@foxses/pay-binance
Binance Pay payment provider for foxses-pay.
Accept crypto payments via Binance Pay — BTC, ETH, BNB, USDT and 70+ cryptocurrencies.
Install
npm install @foxses/pay-core @foxses/pay-binanceOr use the all-in-one package:
npm install @foxses/payUsage
import { PaymentGateway } from "@foxses/pay-core";
import "@foxses/pay-binance";
const gateway = new PaymentGateway();
gateway.use("binance", {
apiKey: "YOUR_BINANCE_PAY_API_KEY", // Certificate SN
secretKey: "YOUR_BINANCE_PAY_SECRET_KEY",
successUrl: "https://yoursite.com/success",
failureUrl: "https://yoursite.com/cancel",
});
// Step 1: Create order
const payment = await gateway.createPayment("binance", {
amount: 10,
currency: "USDT",
orderId: "ORDER001",
});
// Redirect user to:
console.log(payment.checkoutUrl); // Binance hosted checkout
// Step 2: Verify after payment
const result = await gateway.verifyPayment("binance", {
transactionId: payment.transactionId, // prepayId
});
console.log(result.status); // "completed" | "pending" | "cancelled"Getting Credentials
- Go to merchant.binance.com
- API management → Create API
- Copy Certificate SN (apiKey) and Secret Key
Documentation
paydoc.foxses.com/docs/providers/binance
License
MIT © Foxses Studio
