跳到主要内容

USB模式接口列表

消息结构

字段格式

POS应用程序和CodePay寄存器以JSON格式通信

公共字段

本文件根据以下约定对每个字段的不同方面进行了定义。

  • M:所需参数
  • C:满足某些条件时所需的参数
  • O:可选参数
  • -:不存在 常见参数如下:
参数 类型 请求 响应 说明
topicstringMOMessage topic identifier. Please refer to the topic Example: ecrhub.pay.order
request_idstringOOTransaction Request ID, used to receive the corresponding response. The caller needs to remain unique.
timestampstringOOTimestamp Example: 1698302992263
versionstringOOThe API version. fixed value:1.0 Example: 1.0
app_idstringMOThe payment app id registered in Codepay Gateway, 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 CodePay Register, 000 means the transaction was successful, other means the transaction failed.Please refer to Response code

response_msgString-CFailed transaction error message returned by CodePay Register

输入参数结构图

跨终端应用集成WLAN/LAN模式,输入参数结构图

输出参数结构图

跨终端应用集成WLAN/LAN模式,输出z参数结构图

主题

每种交易类型都有一个消息主题:

Key Name
ecrhub.pay.orderSubmit transaction
ecrhub.pay.queryQuery transaction
ecrhub.pay.closeClose transaction
ecrhub.pay.batch.closeBatch close
ecrhub.pay.tip.adjustmentTip adjustment

交易消息

1. 提交交易

消息主题

ecrhub.pay.order

参数 类型 请求 响应 说明
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: 121775014073233368018
orig_merchant_order_nostringC-Original merchant order number. If the transaction type is Cancellation, Refund and Pre-Authorization Cancellation, Pre-Authorization Completion, it must be required. (trans_type == 2,3,5,6) Example: 121775014073233368018
orig_pay_channel_trans_nostringC-Original payment channel transaction number. Required. If the transaction type is Cancellation, Refund and Pre-Authorization Cancellation, Pre-Authorization Completion, it must be required. (trans_type == 2,3,5,6) Example: 100000009
price_currencystringOOPrice Currency, compliant with ISO-4217 standard, described with a three-character code Example:USD
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
tax_amountStringOOTax amount. This field represents the transaction tip amount. For example, 1 USD stands for one dollar, not one cent.
on_screen_tipbooleanO-Whether or not to enter tips on the CodePay Register page, default is false, when "trans_type=1, 3, 4", this parameter can be set

Example: true
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 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 order 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 CodePay gateway to call back the server address, and only when the transaction goes through the PayCloud payment gateway will there be a callback. Example: http://www.abc.com/callback?id=12345
expiresstringOOOrder 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
on_screen_signaturebooleanOOThis parameter controls the display logic of electronic signatures:
  • true: Display the electronic signature page and print the signature information on the purchase order
  • false: The electronic signature page will not be displayed, but the signature area needs to be printed on the purchase order
But even if this parameter is set, CodePay Register still processes electronic signatures according to the following logic in the following situations:
  • Credit card network, APP does not display signature page, fixed on receipt to print signature column

  • Pin debit transactions do not require a signature, the APP does not display a signature page, and the receipt is not printed either
trans_nostring-MTransaction number of CodePay. which uniquely identifies a transaction. Example: 5021000010210602000003
trans_statusstring-MTransaction status, please refer to Transaction status
pay_channel_trans_nostring-OPayment channel transaction serial number, If trans_status is '2', the returned data will include this parameters. such as Visa, Mastercard and other payment platforms. Example: 000000123
discount_bmopcstring-OIf trans_status is '2', the returned data will include this parameters. The merchant gives the customer a preferential amount through the payment channel, and this part of the payment channel will not be settled to the merchant. Example: 3.00
discount_bpcstring-OIf trans_status is '2', the returned data will include this parameters. Discount the amount of the payment channel to the customer, and this part of the funds will be settled into the merchant account. Example: 5.00
trans_end_timestring-OIf trans_status is '2', the returned data will include this parameters. Transaction completed time. time zone: Local time zone, the system time zone set by the payment terminal, format: YYYY-MM-DD HH: mm:ss. Example: 2021-06-03 12:48:51

2. 查询交易

消息主题

ecrhub.pay.query

参数列表

参数 Type 请求s 响应 说明
merchant_order_noStringMMMerchant order number of the original transaction.
trans_typeString-MTransaction type. Please refer to Transaction type.
price_currencyString-MPrice Currency, compliant with ISO-4217 standard, described with a three-character code.
order_amountString-MOrder amount. Order amount in base currency units (e.g., 1.00 USD = one dollar).
tip_amountString-OTip amount. This field represents the transaction tip amount. For example, 1 USD stands for one dollar, not one cent.
tax_amountString-OTax amount. This field represents the transaction tip amount. For example, 1 USD stands for one dollar, not one cent.
cashback_amountString-OCashback amount. Expressed in the quoted currency, for example, One USD stands for one dollar, not one cent.
attachString-OAdditional data.Allows merchants to submit additional data, which will be returned as is.
pay_scenarioString-OPayment scene, If trans_status is 2, the returned data will include the following parameters, please refer to Please Refer to PayScenario .
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 trans_type is 3, this parameter will not required.
card_network_typeString-OBank card network, when this parameter is not required, the bank card transaction selects the network based on the type of card being read,please refer to Card Network Type.
trans_noString-MTransaction number of CodePay. which uniquely identifies a transaction.
trans_statusString-MTransaction status, please refer to Transaction status.
trans_end_timestring-MTransaction 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.
cashierstring--The cashier's id number or name, the transaction will record this field for easy tip counting.
auth_codestring-CAuthentication code. Returned for card transactions.
ref_nostring-CRetrieval Reference Number .Returned for card transactions.
card_nostring-CCard PAN number, Masked per PCI DSS (e.g., 430277****5723). Returned for card transactions.
entry_modestring-CReturned for card transactions:1: Magnetic stripe swipe, 2: Contact chip, 3: Contactless, 4: Manual entry.
merchant_nostring-CThe merchant no.
merchant_namestring-CThe merchant name.
pay_channel_merchant_idstring-CMerchant id of the payment channel,channel example: TSYS,ELAVON.
pay_channel_terminal_idstring-CTerminal id of the payment channel,channel example: TSYS,ELAVON.

3. 关闭交易

消息主题

ecrhub.pay.close

参数列表

参数 Type 请求s 响应 说明
merchant_order_noStringCCMerchant order number of the original transaction.

4.批结算

消息主题

ecrhub.pay.batch.close

5. 小费调整

消息主题

ecrhub.pay.tip.adjustment

参数列表

Name Type Request Response Description
merchant_order_noStringM-Merchant order number requiring tip adjustment transaction.
tip_adjustment_amountStringM-Tip adjustment amount. For example, 1 USD stands for one dollar, not one cent.