Use case:
To ensure the health of the system, it is required that the terminal to sync up with the Alipay system every 30 minutes. The action will help Alipay and other parties to monitor and maintain a healthy and efficient system.
Remarks:
For merchants that integrate with bar-code payment version 2.0 (bar-code payment and wave sound payment) can integrate with this interface. The gateway URL is http://mcloudmonitor.com/gateway.do.
1)Construct the request data
The merchant generates the request and signature based on the API spec provided by Alipay
2)Send request
Send the request to API via URL page redirect or web form.
3)Data processing
After getting the request data, Alipay will validate and process them.
4)Return the result data
Alipay return the processed data to the merchant in JSON format.
5)Clear the performance record between two sync-ups
After the merchant gets the response from Alipay, it should clear the performance record on the merchant side between two sync-ups to avoid data duplication.
Parameter | Type | Mandatory | Length | Description | Sample |
---|---|---|---|---|---|
product | String | Y | 5 | The Alipay solution that the sync-up is bond with. For now we support only FP. | FP |
type | String | Y | 10 | The device type which sends the heartbeat sync-up: CR——Terminal;STORE——Store;VM——Vending Machine |
CR |
equipment_id | String | Y | 32 | Equipment id. If it is a terminal, it is the terminal id, whose min length is 6. If there is no equipment id, MAC address could be used here. | 1001023 |
time | String | Y | 19 | Time of the heartbeat, in the format of “yyyy-MM-dd HH:mm:ss” | 2015-01-22 16:46:02 |
store_id | String | Y | 32 | Store id which needs to be the same as the store_id in the payment API call. If there is no store id, please fill in “DF”. | 112 |
network_type | String | Y | 4 | Network type that POS devices connect with: 2G、3G、WIFI、LAN. | LAN |
equipment_status | String | Y | 2 | Equipment status: 10——device/software start-up;20——device/software shutdown;30——Normal |
10 |
sys_service_provider_id | String | N | 16 | System service provider id. | 2088511833207846 |
mac | String | N | 64 | MAC address. | 01-23-45-67-89-AB |
trade_info | String | N | 256 | The payment performance information between two heartbeat sync-ups. It includes all the order numbers, time consumed, and status. The maximum is the first 30 payments. The data is in JSON format. More details please refer to the following section “payment performance information parameters” If we have multiple payment transactions, we can combine them in the order and payment time.If the heartbeat sync-up fails to be sent due to the network issues, the trade performance info could continue to accumulate until the sync-up succeeds and local data could be cleared. This data is very important. It should be filled if there is payment in the time frame. |
[{“OTN”:“201508011234”,“TC”:“5”,“STAT”:“S”},{“OTN”:“201508012345”,“TC”:“15”,“STAT”,“X”}] |
exception_info | String | N | 128 | The information of the exceptions within the 2 heartbeats. If there are multiple exceptions, separate them with “|”. HE_PRINTER——Printer exception; HE_SCANER——scanner exception; HE_OTHER——Other hardware exceptions |
HE_PRINTER |
extend_info | String | N | 256 | The extended info defined by the sender, in JSON format. | {“SHOP_ID”:“BJ_ZZ_001”,“TERMINAL_ID”:“1234”} |
Payment Performance Information Parameters
Parameter | Type | Mandatory | Length | Description | Sample |
---|---|---|---|---|---|
OTN | String | Y | 32 | Merchant order number. | 201508011234 |
TC | String | Y | 8 | The time consumed from barcode scanning to the return of payment result, in seconds. | 5.315 |
STAT | String | Y | 1 | Status of the payment: S—Succes; I——In-progress return from Alipay; F——Failure return from Alipay; P——Failure with the merchant cashier system; X——Netwrok connection exception; Y——Exception in sending the request; Z——Exception in receiving the response; C——Cancelled by cashier |
S |
Sample:
1 2 3 4 5 6 | ---> HTTP POST http: //mcloudmonitor.com/gateway.do Content-Type: application/x-www-form-urlencoded; charset=UTF- 8 Content-Length: 926 sign=pRuVxmlnsd4NNaRP3RACZLfejHNEnCKlLklO16o0tKv3To29TlKyAUuuM+xjd6wSd0g7rWYFGNY0SQWaXgwQZXrhx4jPKjk/aDYRvueURepQM9KB5GudAVqaour2hyAychGFZ3yHaoX5zLrWyjObPjeqSUsT0BmgmsN8ps/E7Xk=&biz_content={ "product" : "FP" , "type" : "CR" , "equipment_id" : "cr1000001" , "equipment_status" : "30" , "time" : "2015-09-28 11:14:49" , "store_id" : "store10001" , "network_type" : "LAN" , "mac" : "0a:00:27:00:00:00" , "trade_info" :[{ "OTN" : "00000001" , "TC" : 5 , "STAT" : "S" },{ "OTN" : "00000002" , "TC" : 4 , "STAT" : "F" },{ "OTN" : "00000003" , "TC" : 11 , "STAT" : "P" }],"exc eption_info ":" HE_SCANER|HE_PRINTER|HE_OTHER"}×tamp= 2015 - 10 - 23 15 : 41 : 47 &sign_type=RSA2&charset=utf- 8 &method=monitor.heartbeat.syn&app_id= 2014100900013222 &version= 1.0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | The result of “Success” return { "monitor_heartbeat_syn_response" : { "code" : "10000" , "msg" : "同步心跳信息成功" } } The result of “Failed” return { "monitor_heartbeat_syn_response" : { "code" : "40004" , "sub_code" : "ILLEGAL_SIGN" , "msg" : "接口调用异常" , "sub_desc" : "签名不正确" } } |
Name | Description | Solution |
---|---|---|
ILLEGAL_ARGUMENT | At least one of the parameters is not valid. | Examine the request parameters and resend the request after fixing the issue. |
SYSTEM_ERROR | System error. | If the error persists after multiple retries, please contact Alipay support team. |
isv.invalid-app-id | Invalid APP_ID. | Contact Alipay CS to get the valid APP_ID. |
isv.invalid-signature | Invalid signature. | Examine the signature function and retry. |
Remarks:
When integrate with this API, please do not impact the payment’s functionality and performance. When Alipay completes the processing, Alipay will return the feedback to the merchant. The merchant could use programs to simulate http to get the process the result and help the processing logic. The merchant must be able to judge if the result has been processed previously. If the merchant fails to do that, there is a potential risk that the merchant would be responsible for.