Binance Pay APIs

Merchant Endpoints

class Merchant(key=None, secret=None, **kwargs)
batch_payout(requestId: str, batchName: str, currency: str, totalAmount: float, totalNumber: int, transferDetailList: dict, **kwargs)

Batch Payout

Payout API used for Merchant/Partner to make transfers in batch.

POST /binancepay/openapi/payout/transfer

https://developers.binance.com/docs/binance-pay/api-payout

Parameters
  • requestId (str) – The unique ID assigned by the merchant to identify a payout request.

  • bizScene (str, optional) –

  • batchName (str) – The name of the batch payout.

  • currency (str) – Crypto token only, fiat NOT supported. All characters must be in uppercase

  • totalAmount (float) –

  • totalNumber (int) –

  • transferDetailList.merchantSendId (str) –

  • transferDetailList.receiveType (str) –

  • transferDetailList.receiver (str) –

  • transferDetailList.transferAmount (float) –

  • transferDetailList.transferMethod (str) – FUNDING_WALLET, SPOT_WALLET

  • transferDetailList.remark (str) –

Keyword Arguments

bizScene (str, optional) –

cancel_order(**kwargs)

Close Order

Close order API used for merchant/partner to close order without any prior payment activities triggered by user. The successful close result will be notified asynchronously through Order Notification Webhook with bizStatus = “PAY_CLOSED”

POST /binancepay/openapi/order/close

https://developers.binance.com/docs/binance-pay/api-order-close

Keyword Arguments
  • prepayId (str, optional) – Binance unique order id

  • merchantTradeNo (str, optional) – The order id, Unique identifier for the request

get_order(**kwargs)

Query Order

Query order API used for merchant/partner to query order status

POST /binancepay/openapi/v2/order/query

https://developers.binance.com/docs/binance-pay/api-order-query-v2

Keyword Arguments
  • prepayId (str, optional) – Binance unique order id

  • merchantTradeNo (str, optional) – The order id, Unique identifier for the request. Will be ignored if prepayId already provided

get_payout(requestId: str, **kwargs)

Payout Query

Payout query API used for Merchant/Partner to query transfer status.

POST /binancepay/openapi/payout/query

https://developers.binance.com/docs/binance-pay/api-payout-query

Parameters

requestId (str) – The unique ID assigned by the merchant to identify a payout request.

Keyword Arguments

detailStatus (str) –

get_refund_order(refundRequestId: str, **kwargs)

Query Refund Order

Refund order API used for Marchant/Partner to refund for a successful payment.

POST /binancepay/openapi/order/refund/query

https://developers.binance.com/docs/binance-pay/api-order-refund

Parameters

refundRequestId (str) – The unique ID assigned by the merchant to identify a refund request.

get_transfer_result(tranId: str, **kwargs)

Query Transfer Result

Query Transfer Result API used for merchant/partner to query transfer result.

POST /binancepay/openapi/wallet/transfer/query

https://developers.binance.com/docs/binance-pay/api-wallet-transfer-query

Parameters

tranId (str) – the value of requestId of provoking Transfer Fund API

get_wallet_balance(wallet: str, currency: str, **kwargs)

Wallet Balance Query

query wallet balance.

POST /binancepay/openapi/balance

https://developers.binance.com/docs/binance-pay/api-balance-query

Parameters
  • wallet (str) – FUNDING_WALLET, SPOT_WALLET

  • currency (str) – Currency to query, e.g, “BUSD”

new_order(params)

Create Order

POST /binancepay/openapi/v2/order

Create order API Version 2 used for merchant/partner to initiate acquiring order. https://developers.binance.com/docs/binance-pay/api-order-create-v2

Parameters
  • merchant.subMerchantId (str, optional) –

  • env.terminalType (str) –

  • env.osType (str, optional) –

  • env.orderClientIp (str, optional) –

  • env.cookieId (str, optional) –

  • merchantTradeNo (str) –

  • orderAmount (float) –

  • currency (str) –

  • goods.goodsType (str) –

  • goods.goodsCategory (str) –

  • goods.referenceGoodsId (str) –

  • goods.goodsName (str) –

  • goods.goodsDetail (str) –

  • goods.goodsUnitAmount.currency (str) –

  • goods.goodsUnitAmount.amount (float) –

  • goods.goodsQuantity (str, optional) –

  • shipping.shippingName.firstName (str) –

  • shipping.shippingName.middleName (str, optional) –

  • shipping.shippingName.lastName (str) –

  • shipping.shippingAddress.region (str) –

  • shipping.shippingAddress.state (str, optional) –

  • shipping.shippingAddress.city (str, optional) –

  • shipping.shippingAddress.address (str, optional) –

  • shipping.shippingAddress.zipCode (str, optional) –

  • shipping.shippingAddress.shippingAddressType (str, optional) –

  • shipping.shippingAddress.shippingPhoneNo (str, optional) –

  • buyer.referenceBuyerId (str, optional) –

  • buyer.buyerName.firstName (str) –

  • buyer.buyerName.middleName (str, optional) –

  • buyer.buyerName.lastName (str) –

  • buyer.buyerPhoneCountryCode (str, optional) –

  • buyer.buyerPhoneNo (str, optional) –

  • buyer.buyerEmail (str, optional) –

  • buyer.buyerRegistrationTime (str, optional) –

  • buyer.buyerBrowserLanguage (str, optional) –

  • returnUrl (str, optional) –

  • cancelUrl (str, optional) –

  • orderExpireTime (int, optional) –

  • supportPayCurrency (str, optional) –

  • appId (str, optional) –

new_sub_merchant(merchantName: str, merchantType: int, merchantMcc: str, country: str, **kwargs)

Create SubMerchant

Create Sub-merchant API used for merchant/partner.

POST /binancepay/openapi/submerchant/add

https://developers.binance.com/docs/binance-pay/api-submerchant-add

Parameters
  • merchantName (str) – The sub merchant name maximum length 128, unique under one mainMerchantId.

  • merchantType (int) –

    1=Personal(Individual)

    2=solo proprietor

    3=Partnership

    4=Private company

    5=Others company

  • merchantMcc (str) – MCC Code, get from Binance

  • country (str) –

    Country/Region of Business Operation,Can be multiple, split by “,” eg:”SG,US”

    iso alpha 2 country code(https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), use “GO” if global

Keyword Arguments
  • brandLogo (str, optional) – sub merchant logo url

  • address (str, optional) –

  • companyName (str, optional) –

  • registrationNumber (str, optional) –

  • registrationCountry (str, optional) –

  • registrationAddress (str, optional) –

  • incorporationDate (int, optional) –

  • storeType (int, optional) –

  • siteType (int, optional) –

  • siteUrl (str, optional) –

  • siteName (str, optional) –

  • certificateType (int, optional) – 1=ID 2=Passport, Required if merchantType is Individual

  • certificateCountry (str, optional) –

  • certificateNumber (str, optional) –

  • certificateValidDate (int, optional) –

  • contractTimeIsv (int, optional) –

refund_order(refundRequestId: str, prepayId: str, refundAmount: float, **kwargs)

Refund Order

Refund order API used for Marchant/Partner to refund for a successful payment.

POST /binancepay/openapi/order/refund

https://developers.binance.com/docs/binance-pay/api-order-refund

Parameters
  • refundRequestId (str) – The unique ID assigned by the merchant to identify a refund request.The value must be same for one refund request.

  • prepayId (str) – The unique ID assigned by Binance for the original order to be refunded.

  • refundAmount (float) – You can perform multiple partial refunds, but their sum should not exceed the order amount.

Keyword Arguments

refundReason (str, optional) –

transfer_fund(requestId: str, currency: str, amount: str, transferType: str, **kwargs)

Transfer Fund

Fund transfer API used for merchant/partner to initiate Fund transfer between wallets.

POST /binancepay/openapi/wallet/transfer

https://developers.binance.com/docs/binance-pay/api-wallet-transfer

Parameters
  • requestId (str) – Represents the unique ID of each transfer request.Generated by the merchant

  • currency (str) – transfer currency, e.g. “BUSD”

  • amount (str) – the transfer amount

  • transferType (str) – Only TO_MAIN OR TO_PAY