查询开发者账户信息
开发者查询自己的账户信息,包括基本信息以及账户余额等, 开发者除了调用接口查询自己的余额之外,也可以通过管理后台界面查看余额,必要时进行在线充值 。
接口地址:
参数名 | 类型 | 说明 | 示例 |
---|---|---|---|
appid | String | 开发者AppId | 开放平台提供 |
timestamp | long | 当前时间戳,开发者的接口请求和开放平台的时间差在5分钟之内。 | |
sign | string | 接口签名 ,对请求参数进行签名,签名算法可参考附件示例代码 |
请求示例
String result ="";
String url = "https://kf.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);
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":{"appid":"hiGInwtLfI1vy22af","balance": 999.23,"contact_name":"张三","created":"2020-02-16 20:18:08","mobile":"158221120112","site_name":"国卡分销"}}
其中,code为0表示成功,非0为失败,失败时,message中会有失败信息, balance为当前账户余额。强烈建议开发者关注自己的账户余额,当余额不足时,将不能调用相关接口!!
文档更新时间: 2023-10-31 15:52 作者:admin