凭证识别
# 代码示例
- 代码示例仅供参考,具体参数说明请参考请求参数说明
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);
}
}
# 请求地址
- 请求方式 : POST
- 请求地址 : https://tl-openapi.toppay.asia/gateway/order/check
# 请求参数
| 参数 | 必填 | 类型 | 描述 | 示例 |
|---|---|---|---|---|
| mchId | Y | String | 商户ID | S012031948905787 |
| orderNum | Y | String | 商户订单号 | A123456789 |
| qrCode | Y | String | 图片内容(qrCode) | qrCode:002123124716478189479838124781BHU678T778gB100.0072BHSJC7N |
| sign | Y | String | RSA签名 | ja6R8eukQ... |
# 请求报文示例
{
"mchId": "S012031948905787",
"orderNum": "A123456789",
"qrCode": "002123124716478189479838124781BHU678T778gB100.0072BHSJC7N",
"sign": "X/o+IQUzLJqYe9Feid9Uww72mJGOvhJSJEIfo1EUChrZyVZnzGHtd61QhOqRmXCtAwk7V7k="
}
# 响应参数
| 参数 | 必填 | 类型 | 描述 | 示例 |
|---|---|---|---|---|
| success | Y | boolean | 接口响应 | true/false |
| code | Y | int | 接口响应码 | 1000代表请求成功,其他的都为请求失败 |
| message | Y | String | 接口响应信息 | 返回具体响应信息 |
| data | Y | Json | 接口响应参数 | data |
| titleCode | Y | String | 识别结果状态码 | 1000代表成功,其他的都为失败 |
| titleMsg | Y | String | 识别结果 | 返回具体响应信息 |
# 响应报文示例
{
"success": true,
"code": 1000,
"message": "SUCCESS",
"data": {
"titleMsg": "Payment voucher recognition information incomplete",
"titleCode": "1003"
}
}
# 识别结果状态码(titleCode)
| TitleCode | TitleMsg | Desc |
|---|---|---|
| 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 | 凭证付款时间非近3天,请人工查询 |
| 1005 | Payment voucher has been recognized twice | 该付款凭证已重复识别,请人工确认 |
| 2001 | The current voucher's receiving card is not TopPay | 当前凭证收款卡非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 | 金额过大,请人工确认订单 |