查询商家支付宝信息
查询商户支付宝中的有效余额,冻结余额等, 需要淘宝卖家授权。
接口地址:
参数名 | 类型 | 说明 | 示例 |
---|---|---|---|
appid | String | 开发者AppId | 开放平台提供 |
tb_seller_nick | String | 要查询的商家, 淘宝卖家店铺登录账号,非店铺名称 | kingdo |
timestamp | long | 当前时间戳,开发者的接口请求和开放平台的时间差在5分钟之内。 | |
sign | string | 接口签名 ,对请求参数进行签名,签名算法可参考附件示例代码 |
请求示例
String result ="";
String url = "https://open.fw199.com/gateway/alipay/account/detail";
String tb_seller_nick = Config.TBSellerNick ; //要查询支付宝的淘宝商家
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost( url );
//业务参数
Map<String, String> data = new HashMap<String, String>();
data.put("appid", Config.AppId);
data.put("tb_seller_nick", tb_seller_nick);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
//发起POST请求
try {
//参数签名
data.put("sign", Utils.Sign(data,Config.AppSecret));
List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
for (Map.Entry<String, String> entry : data.entrySet()) {
params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse httpResponse = httpclient.execute(httpPost);
if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
result = EntityUtils.toString(httpResponse.getEntity());
} else {
result = ("doPost Error Response: " + httpResponse.getStatusLine().toString());
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(result);
返回示例
{"code":0,"message":"ok","data":{"alipay_user_id":"2088502785989711","available_amount":"19.17","freeze_amount":"0.00","total_amount":"19.17"}}
其中,code为0表示成功,非0为失败,失败时,message中会有失败信息。 available_amount为有效余额,
freeze_amount为冻结余额, total_amount为总金额。
文档更新时间: 2023-03-14 16:36 作者:admin