测试服务地址 https://xxx.a.com 请使用此地址拼接请求地址,例如订单查询 https://xxx.a.com/api/v1/openapi/card/query
服务地址请咨询商务获取
/api/v1/openapi/card/submit
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| customerId | 是 | int | 商户ID |
| orderNo | 是 | string | 商户单号,6-32位 |
| batchNo | 否 | string | 批次号,默认为商户单号 |
| productCode | 是 | int | 商品编号 |
| face | 是 | int | 面值 |
| cardNo | 是 | string | 卡号(参照卡号卡密加密方式) |
| cardPassword | 是 | string | 卡密(参照卡号卡密加密方式) |
| notifyURL | 是 | string | 异步通知url |
| sign | 是 | string | 签名 |
customerId&orderNo&productCode&face&cardNo&cardPassword¬ifyURL&商户密钥 md5加密后转小写 其中cardNo cardPassword须未加密计算sign
加密密钥为商户密钥的前32位 AES/ECB/PKCS5Padding 128位 结果hex
/** * AES加密 * * @param data * @return * @throws Exception */ public static String encrypt(String data, String keyStr) throws Exception { Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); SecretKeySpec key = new SecretKeySpec(keyStr.getBytes(StandardCharsets.UTF_8), "AES"); cipher.init(1, key); return HexBin.encode(cipher.doFinal(data.getBytes(StandardCharsets.UTF_8))); }
/** * AES解密 * * @return * @throws Exception */ public static String decrypt(String base64Data, String keyStr) throws Exception { Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); SecretKeySpec key = new SecretKeySpec(keyStr.getBytes(StandardCharsets.UTF_8), "AES"); cipher.init(2, key); return new String(cipher.doFinal(HexBin.decode(base64Data))); }bin2hex(openssl_encrypt('需要加密的内容', 'aes-256-ecb', '32位密钥', OPENSSL_RAW_DATA)){ "batchNo": "D1000010", "cardNo": "7D5C813D566EDEB336997FC49A7F72B2FC3E5D0631E90681685820FA578D06C8", "cardPassword": "F7A21C51BA90005326ECFCEF0AF592EDFC3E5D0631E90681685820FA578D06C8", "customerId": 5, "face": 100, "notifyURL": "https://baidu.com", "orderNo": "F1000899900", "productCode": 5, "sign": "cb40e654a76cfe3d2ea3d5585ef84fb2"}提交成功
{ "customerId": 5, "orderNo": "F100089990002", "remarks": "提交成功", "status": "Ok"}提交失败{ "customerId": 5, "orderNo": "F100089990002", "remarks": "卡已有处理中记录", "status": "F006"}| 参数名 | 类型 | 为空 | 说明 |
|---|---|---|---|
| customerId | int | N | 商户ID |
| orderNo | string | N | 订单号 |
| status | String | N | 状态 |
| remarks | string | N | 提示内容 |
| 状态 | 提交失败 | 说明 |
|---|---|---|
| Ok | N | 提交成功 |
| F001 | Y | 签名不正确 |
| F002 | Y | 请求实体数据格式校验不通过 |
| F003 | Y | 商户不存在 |
| F004 | Y | 商户状态异常 |
| F005 | Y | 卡密加密异常 |
| F006 | Y | 卡已有处理中记录 |
| F007 | Y | 卡已有成功记录 |
| F008 | N | 订单号已存在 |
| F009 | Y | 产品未开通或不存在 |
| F010 | Y | 面值维护中 |
| F011 | Y | 商户被关闭 |
| F012 | Y | 商品编码与面值不符 |
| F999 | Y | 未知异常 |
/api/v1/openapi/card/query
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| customerId | 是 | int | 商户ID |
| orderNo | 是 | string | 商户订单号 |
| sign | 是 | string | 签名 |
customerId&orderNo&商户密钥 md5加密后转小写
销卡失败 { "orderNo": "F1000899901110", "remarks": "卡无效", "status": "Fail"}销卡成功状态{ "settlementAmount": 87.0000, "customerId": 5, "finishTime": "2021-08-31 17:14:17", "orderNo": "F1000899900", "actualFace": 100, "remarks": "销卡成功", "status": "Ok", "systemOrderNo": "F16299501209738407332"}返回参数说明
| 参数名 | 类型 | 可为空 | 说明 |
|---|---|---|---|
| customerId | int | N | 商户ID |
| orderNo | string | N | 订单号 |
| remarks | string | N | 描述状态 |
| status | string | N | 状态 |
| systemOrderNo | string | Y | 系统单号 |
| settlementAmount | string | Y | 商户收入金额 |
| finishTime | string | Y | 完成时间 |
| actualFace | int | Y | 实际面值,面值不符时实际面值不为0 |
| settlementFace | int | Y | 结算面值 |
| 状态 | 成功 |
|---|---|
| Ok | 核销成功,务必判断settlementFace是否为0,面值不符可能成功无结算面值 |
| Process | 处理中 |
| Fail | 销卡失败 |
| F001 | 签名不正确 |
| F003 | 商户不存在 |
| F005 | 订单不存在 |
| F999 | 其他异常 |
销卡成功{ "actualFace": 1000, "customerId": 20000, "finishTime": "2021-09-17 11:04:10", "orderNo": "F16318478480965062625", "productCode": 100000, "remarks": "销卡成功", "settlementAmount": "862.0000", "sign": "5ad56153c2e3be079a79f7d2d062847e", "status": "Ok", "systemOrderNo": "JW1631847849423F1000"}其他状态{ "actualFace": 0, "customerId": 20000, "finishTime": "2021-09-17 11:04:10", "orderNo": "F16318478480965062625", "productCode": 100000, "remarks": "卡有处理记录", "settlementAmount": "0.0000", "sign": "5ad56153c2e3be079a79f7d2d062847e", "status": "Fail", "systemOrderNo": "JW1631847849423F1000"}| 参数名 | 类型 | 可为空 | 说明 |
|---|---|---|---|
| customerId | int | N | 商户ID |
| orderNo | string | N | 订单号 |
| productCode | string | N | 商品编码 |
| remarks | string | N | 描述状态 |
| status | string | N | 状态 |
| systemOrderNo | string | N | 系统单号 |
| settlementAmount | string | Y | 商户收入金额 |
| finishTime | string | Y | 完成时间 |
| actualFace | int | Y | 实际面值 |
| settlementFace | int | Y | 结算面值 |
customerId&orderNo&systemOrderNo&productCode&status&actualFace&settlementFace&settlementAmount&商户密钥 md5加密后转换成小写
Ok 核销成功Process 处理中Fail 销卡失败/api/v1/openapi/card/cancel
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| customerId | 是 | int | 商户ID |
| orderNo | 是 | string | 商户订单号 |
| sign | 是 | string | 签名 |
customerId&orderNo&商户密钥 md5加密后转小写
取消失败{"message": "暂不支持取消","orderNo": "F1000899900","status": "F999"}取消已被受理{"message": "success","orderNo": "F1000899900","status": "Ok"}
| 参数名 | 类型 | 可为空 | 说明 |
|---|---|---|---|
| message | int | N | 描述信息 |
| orderNo | string | N | 订单号 |
| status | string | N | 状态 |
状态说明
xxxxxxxxxxOk 取消被受理F999 取消失败