Skip to main content

WLAN/LAN Mode API List

Communication Protocol

WiseCashier uses the WebSocket protocol to implement the server side. WebSocket is a technology used for arbitrary two-way data transfer between the client and the server. The WebSocket protocol is implemented based on the TCP protocol and consists of an initial handshake and subsequent two-way transfer of multiple data frames. Its purpose is in the WebSocket client and WebSocket server for frequent two-way communication, can make the server to avoid opening multiple HTTP connections to work to save resources, improve the efficiency and resource utilization.

Message Structure

Field Format

POS application and WiseCashier communicate in JSON format

Input Parameter Structure Diagram

Cross terminal application integration, WLAN/LAN mode integration input parameter structure diagram

Output Parameter Structure Diagram

Cross terminal application integration, WLAN/LAN mode integration output parameter structure diagram

Common Field

Different aspects of each field are defined in this document according to the following conventions.

  • M: Required parameters
  • C: Required parameters when some conditions are met
  • O: Optional parameters
  • -: Not Present The common parameters is as follows:
Key Parameter type Request Response Description
topicstringMMMessage topic identifier. Enum: ecrhub.pay.order ecrhub.pay.query ecrhub.pay.close
timestampstringM-Timestamp Example: 1698302992263
app_idstringMMThe payment app id registered in PayCloud, Please refer to the Payment gateway integration guide
biz_dataJSONObjectMMBusiness Data. each transaction type has own business data
response_codestring-MThe order payment status code returned by WiseCashier, 000 means the transaction was successful, other means the transaction failed.Please refer to Response code

response_msgString-CFailed transaction error message returned by WiseCashier

Biz Field

1. Submit Transaction

Message Topic

ecrhub.pay.order

Parameter list

Name Type Request Response Description
trans_typeStringMMTransaction type. Please refer to Transaction type

Example: 1
merchant_order_noStringMMMerchant order number.This field represents the order number for the refund request when refunded, different from the order number of the original consumer transaction. No more than 32 alphanumeric characters.

Example: 121775014073233018
orig_merchant_order_noStringCCOriginal merchant order number. If the transaction type is Void, Refund, Completion, it must be required. (trans_type = 2,3,6)

Example: 121775014073233368018
order_amountStringMMOrder amount. This field represents the transaction ordered amount, For example, one USD stands for one dollar, not one cent.

Example: 34.50
tip_amountStringOOTip amount. This field represents the transaction tip amount. For example, 1 USD stands for one dollar, not one cent.

Example: 34.50
cashback_amountStringOOCashback amount. Expressed in the quoted currency, for example, One USD stands for one dollar, not one cent

Example: 10.00
pay_method_idStringOOPayment method id. Please Refer to Payment method

If the TransType is 3, this parameter will not required

Example:Visa
pay_scenarioStringOOPayment scene, please refer to PayScenario

Example: SWIPE_CARD
attachStringOOAdditional data.Allows merchants to submit additional data, which will be returned as is.

Example: abc123
descriptionStringOODescription of ordered goods or services.A brief description of the goods or services purchased by the customer.

Example: IPhone White X2
notify_urlStringOOCallback address for payment notification.Receive payment notifications from the PayCloud to call back the server address, and only when the transaction goes through the PayCloud will there be a callback.

Example: http://www.abc.com/callback?id=12345
expiresNumberOOOrder expires time, after the expires time is not allowed to be paid, unit: seconds

Example: 180
confirm_on_terminalbooleanOODo you need terminal confirmation before proceeding with payment operations? The default is false. When set to true, you need to confirm the order first, otherwise you will directly enter the card reading interface
required_terminal_authenticationbooleanOOWhen refund or void a transaction, does the store manager role need to authorize this operation on the terminal? default value: false
trans_noString-MTransaction number of PayCloud. which uniquely identifies a transaction.

Example: 5021000010210602000003
trans_statusString-MTransaction status, please refer to Transaction status
trans_end_timestring-OTransaction completed time. If trans_status is 2, the returned data will include this parameters. Timezone: Local time zone, the time zone set by the payment terminal, Format: YYYY-MM-DD HH:mm:ss

Example: 2021-06-03 12:48:51
forecourt_dataJSONArrayO-If the merchant is a gas station, use this parameter to set special gas station product information. forecourt_data is an array.
The total sum of forecourt_data item amounts must be equal to the order amount order_amount

The data structure of forecourt_data is as follows.

Name Type Request Response Description
codeStringM-Product Code
It is usually a two-digit numeric code, such as: 02
quantityStringM-Quantity Litres (3 decimals)
Keep three decimal places, for example: 1.050
amountStringM-Amount (cents)
An integer in cents, where 1 South African Rand is represented as 100 here. Its unit is different from order_amount.
Example: 100

2. Query Transaction

Message Topic

ecrhub.pay.query

Parameter list

Name Type Request Response Description
merchant_order_noStringMMMerchant order number.This field represents the order number for the refund request when refunded, different from the order number of the original consumer transaction. No more than 32 alphanumeric characters.

Example: 121775014073233018
trans_typeString-MTransaction type. Please refer to Transaction type

Example: 1
order_amountString-MOrder amount. This field represents the transaction ordered amount, For example, one USD stands for one dollar, not one cent.

Example: 34.50
tip_amountString-OTip amount. This field represents the transaction tip amount. For example, 1 USD stands for one dollar, not one cent.

Example: 34.50
cashback_amountString-OCashback amount. Expressed in the quoted currency, for example, One USD stands for one dollar, not one cent

Example: 10.00
attachString-OAdditional data.Allows merchants to submit additional data, which will be returned as is.

Example: abc123
trans_noString-MTransaction number of PayCloud. which uniquely identifies a transaction.

Example: 5021000010210602000003
trans_statusString-MTransaction status, please refer to Transaction status
pay_scenarioString-OPayment scene, If trans_status is 2, the returned data will include the following parameters, please refer to Please Refer to PayScenario

Example: SWIPE_CARD
pay_method_idString-OPayment method id. If trans_status is 2, the returned data will include the following parameters. Please Refer to Payment method

If the TransType is 3, this parameter will not required

Example:Visa
trans_end_timestring-OTransaction completed time. If trans_status is 2, the returned data will include the following parameters. Timezone: Local time zone, the time zone set by the payment terminal, Format: YYYY-MM-DD HH:mm:ss

Example: 2021-06-03 12:48:51

3. Close Transaction

Message Topic

ecrhub.pay.close

Parameter list

Name Type Request Response Description
merchant_order_noStringMMMerchant order number.This field represents the order number for the refund request when refunded, different from the order number of the original consumer transaction. No more than 32 alphanumeric characters.

Example: 121775014073233018