验证用户的银行卡号、持卡人姓名是否真实。
示例代码:
private static String host = "https://bank.market.alicloudapi.com"; private static String path = "/bank2"; private static String method = "GET"; private static String appcode = "8783cf8695154a3e8fc77b51fbe2****"; /* * checkIsValid * @description:根据银行账号和持卡人姓名验证银行卡的真实性 * @author 李阳 * @date 2018/12/12 * @params [account, name] * @return java.lang.String */ public static String checkIsValid(String account, String name) throws Exception { Map<String, String> headers = new HashMap<String, String>(); //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 headers.put("Authorization", "APPCODE " + appcode); Map<String, String> querys = new HashMap<String, String>(); //持卡人姓名 querys.put("acct_name", name); //卡号 querys.put("acct_pan", account); //是否返回银行所在区域 querys.put("needBelongArea", "true"); /** * 重要提示如下: * HttpUtils请从 * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java * 下载 * * 相应的依赖请参照 * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml */ HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys); //获取response的body return EntityUtils.toString(response.getEntity()); }
正常返回结果:
异常结果:
结果参数:
参考:
https://market.aliyun.com/products/56928004/cmapi012976.html?spm=5176.730005.productlist.d_cmapi012976.9c5c35247n8dJ1&innerSource=search_%E9%93%B6%E8%A1%8C%E5%8D%A1#sku=yuncode697600007
https://www.showapi.com/api/lookPoint/1072