Skip to content

Transaction Message

Native Payment

Transaction Type: Backend transaction

Unified submission address (except for cashier payment): https://openapi.basicex.com/basicexpay/trade/gateway

Request Method: POST

Content-Type: application/json

Note: It is recommended to use the Cashier Payment (basicexpay.trade.cashier) interface for submitting payment orders;

If you choose to use native payment, please use the Transaction Pre-Creation (basicexpay.trade.precreate) interface for submission (only supports BasicEx multi-platform payment).

Cashier Payment (basicexpay.trade.cashier)

Transaction Type: Frontend transaction

Cashier payment is a frontend transaction that is submitted through a form.

Request Method: POST

Content-Type: application/x-www-form-urlencoded

Submission Address: https://openapi.basicex.com/basicexpay/trade/cashier

The parameters submitted through the form have a fixed name of "data", and the value of the parameter is a JSON string that the merchant backend signs and assembles according to the public parameters and request parameter instructions. Here is an example of the form submission page:

ts
<form id="cashier" method="post" contentType="application/x-www-form-urlencoded;charset=utf-8" action="https://openapi.basicex.com/basicexpay/trade/cashier">
	<input type="hidden" name="data" id="data" value="{"merNo":"811496833912834","method":"basicexpay.trade.cashier","timestamp":"20230221155554","nonce":"PIYuG0gFpMhGaDIU","bizConent":"{\"merOrderNo\":\"lZUJVCNLfhlaH1ZzEHIrjszT\",\"clientIp\":\"192.168.1.2\",\"totalAmount\":100,\"currency\":\"USDT\",\"description\":\"TopUp\",\"orderSource\":\"WEB\",\"tradeStartTime\":\"2023-02-21 15:55:54\",\"expireTime\":900,\"notifyUrl\":\"https://www.test.com\",\"returnUrl\":\"https://www.test.com\",\"attach\":\"123\",\"goodsDetails\":[{\"goodsType\":\"112\",\"goodsId\":\"12\",\"goodsName\":\"TopUp\",\"quantity\":1,\"price\":100}]}","signType":"HmacSHA512","sign":"0AF6A4113EC32E9F4A69B62B8842D25AEA7B8C91B260FE98CCF8CEB622F19F1601A4A402999EE2A45CB78B1E8C1961DE4591B3273CB99A85DF5C46DE21B35476"}"/>
</form>
<script>document.forms['cashier'].submit();</script>

Request Parameter Instructions

Note: The order of these request parameters must follow the table below

ParameterTypeRequiredParameter DescriptionExample
merOrderNostring(32)YesMerchant order number, unique within the merchant202202161004008765432
clientIpstring(20)YesClient IP address where the order is placed192.168.1.12
totalAmountdecimal(12,2)YesTotal order amount, accurate to 2 decimal places200
currencystring(100)YesCurrency, supports USDT, BUSD, BCNYUSDT
descriptionstring(255)YesDescription of the goods, displayed on the cashier pageTop-up
orderSourcestring(10)YesOrder source, APP/WEB/WAP/OTHERSWEB
tradeStartTimestring(19)YesTransaction initiation time in the format of yyyy-MM-dd HH:mm:ss2022-02-16 10:04:00
expireTimestring(4)NoOrder expiration time, fixed value 900, in seconds900
notifyUrlstring(255)NoBackend notification URL, the callback address for receiving asynchronous payment results, must be accessible from the Internethttps://api.xxx.com/cashier/notify
returnUrlstring(255)NoFrontend redirect URL, the address to return to the merchant's website after payment completion, must be accessible from the Internethttps://api.xxx.com/cashier/redirect
attachstring(100)NoAdditional data
**+**goodsDetailsNoGoods details (fill in if necessary)
└ goodsTypestring(8)YesGoods category2101
└ goodsIdstring(50)YesGoods ID1001121
└ goodsNamestring(100)YesGoods nameTop-up
└ quantityint(10)YesGoods quantity1
└ pricestring(12)YesGoods unit price, accurate to 2 decimal places200

Request Message Example

ts
{
  "merOrderNo": "swR75kHGS2jQYfeN",
  "clientIp": "127.0.0.1",
  "totalAmount": 18.37,
  "currency": "USDT",
  "description": "Top-up",
  "orderSource": "APP",
  "tradeStartTime": "2023-03-31 22:03:53",
  "expireTime": 900,
  "notifyUrl": "https://google.com",
  "returnUrl": "https://google.com",
  "attach": "",
  "goodsDetails": [
    {
      "goodsType": "01",
      "goodsId": "100001",
      "goodsName": "Test",
      "quantity": 1,
      "price": 18.37
    }
  ]
}

Response Parameter Description

After submitting the parameters in the form, the page will automatically redirect to the BasicEx cashier page.

Transaction Pre-Creation (basicexpay.trade.precreate)

Transaction Type: Backend Transaction

Request Parameter Instructions

Note: The order of these request parameters must follow the table below

ParameterTypeRequiredParameter DescriptionExample
merOrderNostring(32)YesMerchant order number, unique within the merchant202202161004008765432
clientIpstring(20)YesClient IP address where the order is placed192.168.1.12
totalAmountdecimal(12,2)YesTotal order amount, accurate to 2 decimal places200
currencystring(20)YesCurrency, supports USDT, BUSD, BCNYUSDT
networkstring(20)NoTransfer network, supports ERC20, TRC20, POLYGON, BSC, must be provided for external depositsTRC20
descriptionstring(255)YesDescription of the goods, may be displayed on the cashier pageTop-up
orderSourcestring(10)YesOrder source, APP/WEB/WAP/OTHERSWEB
tradeStartTimestring(19)YesTransaction initiation time, 19 characters, format: yyyy-MM-dd HH:mm:ss2022-02-16 10:04:00
expireTimestring(4)NoOrder expiration time, fixed value of 900, in seconds900
notifyUrlstring(255)NoBackend notification address, callback URL to receive asynchronous payment result notifications, must be accessible from the internethttps://api.xxx.com/cashier/notify
returnUrlstring(255)NoFrontend redirect address, URL to return to the merchant's website after payment completion, must be accessible from the internethttps://api.xxx.com/cashier/redirect
attachstring(100)NoAdditional data
networkstring(20)NoTransfer network, supports ERC20, TRC20, POLYGON, BSC, must be provided for external depositsTRC20
**+**goodsDetailsNoGoods details (fill in if applicable)
└ goodsTypestring(8)YesGoods category2101
└ goodsIdstring(50)YesGoods ID1001121
└ goodsNamestring(100)YesGoods nameTop-up
└ quantityint(10)YesGoods quantity1
└ pricestring(12)YesGoods unit price, accurate to 2 decimal places200

Request Message Example

ts
{
  "merOrderNo": "swR75kHGS2jQYfeN",
  "clientIp": "127.0.0.1",
  "totalAmount": 18.37,
  "currency": "USDT",
  "description": "Top-up",
  "orderSource": "APP",
  "tradeStartTime": "2023-03-31 22:03:53",
  "expireTime": 900,
  "notifyUrl": "https://google.com",
  "returnUrl": "https://google.com",
  "attach": "",
  "goodsDetails": [
    {
      "goodsType": "01",
      "goodsId": "100001",
      "goodsName": "Test",
      "quantity": 1,
      "price": 18.37
    }
  ]
}

Response Parameter Description

ParameterTypeRequiredParameter DescriptionExample
orderNostring(32)YesSystem order number generated by BasicEx202201261004008765432
merOrderNostring(32)YesMerchant system internal payment order number, same as the request parameter202201261004008765432
totalAmountdecimal(12,2)YesTotal order amount, accurate to 2 decimal places200
currencystring(20)YesCurrency, supports USDT, BUSD, BCNYUSDT
networkstring(20)NoTransfer network, same as the request parameterTRC20
orderSourcestring(10)YesOrder source, same as the request parameterWEB
codeUrlstring(255)YesPayment QR code data, displayed as a QR code for users to scan and payhttps://qr.basicex.com/811496833912834/C1E988EBCE9EA8DD2CC3A99AB9354EF3
attachstring(100)NoAdditional data, same as the request parameter

Transaction Query (basicexpay.trade.query)

Transaction Type: Backend Transaction

Request Parameter Description

Note: The order of these request parameters must follow the table below

ParameterTypeRequiredParameter DescriptionExample
merOrderNostring(32)NoMerchant system internal payment order number, cannot be empty when orderNo is empty202202161004008765432
orderNostring(32)NoSystem order number generated by BasicEx, cannot be empty when merOrderNo is empty202202161004008765431

Request Message Example

ts
{
    "merOrderNo": "202202161004008765432"
}

Response Parameter Description

ParameterTypeRequiredParameter DescriptionExample
orderNostring(32)YesSystem order number generated by BasicEx, same as the request parameter202201261004008765432
merOrderNostring(32)YesMerchant system internal payment order number, same as the request parameter202201261004008765432
totalAmountdecimal(12,2)YesTotal order amount, accurate to 2 decimal places, same as the request parameter200
currencystring(20)YesCurrency, supports USDT, BUSD, BCNY, same as the request parameterUSDT
statusstring(2)YesTransaction status: 0: Waiting for user payment, 1: Processing, 2: Transaction successful, 3: Expired, 4: Transaction failed2
tradeFinishTimestring(19)YesTransaction completion time2022-02-13 16:29:07
transactionIdstring(60)NoTransaction order number202201261004008765432
buyeridstring(50)NoPayer identifier
attachstring(100)NoAdditional data, same as the request parameter

Refund (basicexpay.trade.refund)

Transaction Type: Backend Transaction

Request Parameter Description

Note: The order of these request parameters must follow the table below

ParameterTypeRequiredParameter DescriptionExample
merOrderNostring(32)NoMerchant system internal payment order number, cannot be empty when orderNo is empty202202161004008765432
orderNostring(32)NoSystem order number generated by BasicEx, cannot be empty when merOrderNo is empty202202161004008765431
merRefundOrderNostring(32)YesMerchant refund order number202202161004008765435
refundAmountdecimal(12,2)YesRefund amount100
refundReasonstring(100)YesRefund reasonRefund
tradeStartTimestring(19)YesTransaction initiation time, 19 digits, format: yyyy-MM-dd HH:mm:ss2022-02-13 16:29:07

Request Message Example

ts
{
    "merOrderNo": "202202161004008765432",
    "merRefundOrderNo": "202202161004008765123",
    "refundAmount": 100,
    "refundReason": "Refund",
    "tradeStartTime": "2022-02-13 16:29:07"
}

Response Parameter Description

ParameterTypeRequiredParameter DescriptionExample
orderNostring(32)NoSystem order number generated by BasicEx, same as the request parameter202201261004008765432
merOrderNostring(32)NoMerchant system internal payment order number, same as the request parameter202201261004008765431
merRefundOrderNostring(32)YesMerchant refund order number202201261004008765436
refundOrderNostring(32)YesSystem refund order number202201261004008765435
refundAmountdecimal(12,2)YesRefund amount, accurate to 2 decimal places, same as the request parameter100
refundStatusstring(2)YesRefund status: 0: Refund in progress, 1: Pending approval, 2: Refund successful, 3: Refund failed2

Refund Query (basicexpay.trade.refund.query)

Transaction Type: Backend Transaction

Request Parameter Description

Note: The order of these request parameters must follow the table below

ParameterTypeRequiredParameter DescriptionExample
merRefundOrderNostring(32)NoMerchant refund order number, cannot be empty when refund system order number orderNo is empty202202161004008765432
refundOrderNostring(32)NoSystem refund order number generated by BasicEx, cannot be empty when merchant refund order number merOrderNo is empty202202161004008765431

Request Message Example

ts
{
    "merRefundOrderNo": "202202161004008765432"
}

Response Parameter Description

ParameterTypeRequiredParameter DescriptionExample
refundOrderNostring(32)YesSystem refund order number generated by BasicEx, same as the request parameter202201261004008765432
merRefundOrderNostring(32)YesMerchant refund order number, same as the request parameter202201261004008765432
refundAmountdecimal(12,2)YesRefund amount, accurate to 2 decimal places, same as the request parameter200
statusstring(2)YesTransaction status: 0: Refund in progress, 1: Pending approval, 2: Refund successful, 3: Refund failed2
tradeFinishTimestring(19)YesTransaction completion time2022-02-13 16:29:07
transactionIdstring(60)NoTransaction ID202201261004008765432
attachstring(100)NoAdditional data, same as the request parameter

Agent Pay (basicexpay.trade.agentpay)

Transaction Type: Backend Transaction

Agent pay transaction is a settlement service provided by BasicEx Pay to meet the merchant's fund withdrawal needs, allowing the merchant to pay funds from their BasicEx Pay account to a specified BasicEx Wallet or a specified Blockchain wallet address.

BasicEx Wallet refers to personal or corporate users who register through the BasicEx Wallet official website. BasicEx Pay will create a BasicEx Wallet for them. The cash accounts of BasicEx Wallets can transfer funds to each other, and funds of different currencies are independent. The same email address, phone number, BasicEx ID, and username can uniquely identify a BasicEx Wallet. The recipient's wallet is determined by specifying the payment recipient type (targetType) and the recipient (target).

Blockchain wallet address: BasicEx Pay supports agent pay requests to wallet addresses on networks such as TRC20, ERC20, POLYGON, and BSC. When agent pay needs to be made to a blockchain wallet address, the recipient type (targetType) must be set to "ADDRESS", and the recipient (target) should be the specific blockchain wallet address.

When the transaction status (status) in the response message is "failed", the order has failed and the merchant can retry the transaction.

When the transaction status (status) in the response message is "processing", the merchant can independently call the Agent Pay Result Query interface to check the status of the order.

Before initiating an agent pay transaction, please ensure that the merchant's cash account has sufficient funds to reduce the chance of transaction failure.

Request Parameter Description

Note: The order of these request parameters must follow the table below

ParameterTypeRequiredParameter DescriptionExample
merOrderNostring(32)YesMerchant order number, unique within the same merchant202202161004008765432
clientIpstring(32)NoClient IP address192.168.1.12
targetTypestring(12)YesType of recipient, can be EMAIL, TELEPHONE, BEID, USERID, ADDRESSEMAIL
targetstring(64)YesRecipient [target] cannot be empty, can be email, phone number, BasicEx ID, username, or address[email protected]
totalAmountdecimal(12,2)YesTotal order amount, accurate to 2 decimal places100
currencystring(50)YesCurrency, supports USDT, BUSD, BCNYUSDT
networkstring(50)NoNetwork, supports TRC20, ERC20, POLYGON, BSC, required when targetType is ADDRESSTRC20
descriptionstring(255)YesDescriptionSalary
orderSourcestring(10)YesOrder source, APP/WEB/WAP/OTHERSWEB
tradeStartTimestring(19)YesTransaction start time, 19 digits, format: yyyy-MM-dd HH:mm:ss2022-02-13 16:29:07
notifyUrlstring(255)NoAgent pay result notification URL, the callback URL that asynchronously receives agent pay result notifications, must be accessible from the internethttps://api.xxx.com/cashier/notify
attachstring(100)NoAdditional data, will be returned as is

Request Message Example

ts
{
  "merOrderNo": "drZW6FffaGpit7Db",
  "clientIp": "127.0.0.1",
  "targetType": "EMAIL",
  "target": "[email protected]",
  "totalAmount": 33.53,
  "currency": "USDT",
  "network": "TRC20",
  "description": "Salary",
  "orderSource": "APP",
  "tradeStartTime": "2023-03-31 22:27:46",
  "notifyUrl": "https://api.xxx.com/cashier/notify",
  "attach": ""
}

Response Parameter Description

ParameterTypeRequiredParameter DescriptionExample
orderNoString(32)YesSystem order number generated by BasicEx Pay, same as the request parameter202201261004008765432
merOrderNoString(32)YesMerchant system internal payment order number, same as the request parameter202201261004008765432
totalAmountDecimal(12,2)YesTotal order amount, accurate to 2 decimal places, same as the request parameter200
currencyString(20)YesCurrency, supports USDT, BUSD, BCNY, same as the request parameterUSDT
orderSourcestring(10)YesOrder source, APP/WEB/WAP/OTHERSWEB
statusString(2)YesTransaction status: 0: Processing, 1: Transaction successful, 2: Transaction failed1
attachString(100)NoAdditional data, same as the request parameter

Agent Pay Result Query (basicexpay.trade.agentpay.query)

Transaction Type: Backend Transaction

Request Parameter Description

Note: The order of these request parameters must follow the table below

ParameterTypeRequiredParameter DescriptionExample
merOrderNostring(32)NoMerchant agent pay order number, merchant system internal agent pay order number, cannot be empty at the same time as system order number orderNo202202161004008765432
orderNostring(32)NoSystem agent pay order number, unique order number generated by BasicEx Pay, cannot be empty at the same time as merchant agent pay order number202202161004008765431

Request Message Example

ts
{
    "merOrderNo": "202202161004008765432"
}

Response Parameter Description

ParameterTypeRequiredParameter DescriptionExample
merOrderNostring(32)YesMerchant system internal payment order number, same as the transaction request parameter202201261004008765431
orderNostring(32)YesSystem order number generated by BasicEx Pay, same as the transaction request parameter202201261004008765432
targetTypestring(12)YesType of recipient, same as the transaction request parameterEMAIL
targetstring(64)YesRecipient, same as the transaction request parameter[email protected]
totalAmountdecimal(12,2)YesTotal order amount, accurate to 2 decimal places, same as the transaction request parameter200
currencystring(20)YesCurrency, supports USDT, BUSD, BCNY, same as the transaction request parameterUSDT
networkstring(50)NoNetwork, same as the transaction request parameterTRC20
descriptionstring(19)YesAgent pay description, same as the transaction request parameterSalary
orderSourcestring(60)NoOrder source, same as the transaction request parameterWEB
attachstring(100)NoAdditional data, same as the transaction request parameter
statusstring(2)YesTransaction status: 0: Processing, 1: Transaction successful, 2: Transaction failed2
tradeFinishTimestring(19)YesTransaction completion time2022-02-13 16:29:07
transactionIdstring(60)NoTransaction ID202201261004008765432

Exchange Rate Query (basicexpay.exchange.rate.query)

Transaction Type: Backend Transaction

Request Parameter Description

Note: The order of these request parameters must follow the table below

ParameterTypeRequiredParameter DescriptionExample
sourcestring(10)YesSource currency, supports USDT, BUSD, BCNYUSDT
targetstring(10)YesTarget currency, supports CNY、EUR、HKD、INR、PHP、Rp、THB、USD、MXNCNY

Request Message Example

ts
{
    "source": "USDT",
    "target": "CNY"
}

Response Parameter Description

ParameterTypeRequiredParameter DescriptionExample
sourcestring(10)YesSource currency, same as the request parameterUSDT
targetstring(10)YesTarget currency, same as the request parameterCNY
ratedecimal(16,2)YesExchange rate, the rate at which one unit of source currency can be exchanged for target currency, for example 1 USDT = 6.96 CNY6.96