Voucher Check
# Code example
Note: Both the merchant order number and the platform order number must be passed one of them, or they can be passed at the same time
TopPayRequestUtil Click to obtain code examples
import com.google.gson.JsonObject;
public class demo {
private static final String PLAT_PUBLIC_KEY = "MIGfMA0GCSqG***AQAB";
private static final String MCH_PRIVATE_KEY = "MIICeAI******IBIuhihgi";
private static final String URL = "https://tl-openapi.toppay.asia/gateway/order/check";
public static void main(String[] args) throws Exception {
query();
}
private static void query() throws Exception {
Map<String, String> requestParams = new TreeMap<>();
requestParams.put("mchId", "S012031948905787");
requestParams.put("orderNum", "A123456789");
requestParams.put("qrCode", "002123124716478189479838124781BHU678T778gB100.0072BHSJC7N");
List<String> paramNameList = new ArrayList<>();
for (String key : maps.keySet()) {
paramNameList.add(key);
}
Collections.sort(paramNameList);
StringBuilder stringBuilder = new StringBuilder();
for (String key : paramNameList) {
stringBuilder.append(requestParams.get(key));
}
String keyStr = stringBuilder.toString();
System.out.println("keyStr:" + keyStr);
String signedStr = TopPayRequestUtil.privateEncrypt(keyStr, TopPayRequestUtil.getPrivateKey(MCH_PRIVATE_KEY));
requestParams.put("sign", signedStr);
String postJson = new Gson().toJson(requestParams);
System.out.println("Post Json Params:" + postJson);
String responseJson = TopPayRequestUtil.doPost(URL, postJson);
System.out.println("Response Msg:" + responseJson);
}
}
# Api
- Method : POST
- Url : https://tl-openapi.toppay.asia/gateway/order/check
# Request param
| Param | Required | Type | Description | Example |
|---|---|---|---|---|
| mchId | Y | String | mch Id | S012031948905787 |
| orderNum | Y | String | mch order number | A123456789 |
| qrCode | Y | String | qrCode | qrCode:002123124716478189479838124781BHU678T778gB100.0072BHSJC7N |
| sign | Y | String | Sign | ja6R8eukQ... |
# Request example
{
"mchId": "S012031948905787",
"orderNum": "A123456789",
"qrCode": "002123124716478189479838124781BHU678T778gB100.0072BHSJC7N",
"sign": "X/o+IQUzLJqYe9Feid9Uww72mJGOvhJSJEIfo1EUChrZyVZnzGHtd61QhOqRmXCtAwk7V7k="
}
# Response param
| Param | Required | Type | Description | Example |
|---|---|---|---|---|
| success | Y | boolean | Is success | true/false |
| code | Y | int | response code | 1000代表请求成功,其他的都为请求失败 |
| message | Y | String | response message | 返回具体响应信息 |
| data | Y | Json | result | data |
| titleCode | Y | String | result code | result code |
| titleMsg | Y | String | result | result |
# Response example
{
"success": true,
"code": 1000,
"message": "SUCCESS",
"data": {
"titleMsg": "Payment voucher recognition information incomplete",
"titleCode": "1003"
}
}
# result code (titleCode)
| TitleCode | TitleMsg |
|---|---|
| 200 | Order replacement successful, please confirm |
| 301 | Frequent requests, please try again later |
| 302 | Image too large to be recognized |
| 303 | Order inquiry service malfunction, please contract customer service |
| 1001 | Payment voucher cannot be recognized |
| 1002 | Payment voucher recognition failed |
| 1003 | Payment voucher recognition information incomplete |
| 1004 | Voucher payment time is not within the last 3 days |
| 1005 | Payment voucher has been recognized twice |
| 2001 | The current voucher's receiving card is not TopPay |
| 2002 | Automatic order replacement is not currently supported |
| 3001 | Payment voucher already has a corresponding order |
| 3002 | Multiple receiving cards correspond |
| 3004 | Voucher matched multiple suspected orders |
| 3005 | Voucher matched suspected order |
| 3006 | Incorrect order provided |
| 3007 | Abnormal order status |
| 3008 | Order amount provided does not match voucher amount |
| 3011 | Amount too large the order |