汇率查询
商户网站的商品以外币标价时,通过该接口可以实时查询到微信使用的转换汇率。汇率更新时间为北京时间上午10:00,一天更新一次。
请求参数 | 类型 | 描述 |
---|---|---|
xml | object | 声明请求的XML 数据结构 |
appid | string | 公众账号ID |
mch_id | string | 商户号 |
fee_type | string | 币种 |
date | string | 日期 |
nonceless | boolean | 声明请求的XML 无随机字符串参数固定值 true |
php
$instance->v2->pay->queryexchagerate->postAsync([
'xml' => [
'appid' => 'wxd678efh567hg6787',
'mch_id' => '1230000109',
'fee_type' => 'USD',
'date' => '20150807',
],
'nonceless' => true,
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/pay/queryexchagerate')->postAsync([
'xml' => [
'appid' => 'wxd678efh567hg6787',
'mch_id' => '1230000109',
'fee_type' => 'USD',
'date' => '20150807',
],
'nonceless' => true,
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/pay/queryexchagerate']->postAsync([
'xml' => [
'appid' => 'wxd678efh567hg6787',
'mch_id' => '1230000109',
'fee_type' => 'USD',
'date' => '20150807',
],
'nonceless' => true,
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->pay->queryexchagerate->post([
'xml' => [
'appid' => 'wxd678efh567hg6787',
'mch_id' => '1230000109',
'fee_type' => 'USD',
'date' => '20150807',
],
'nonceless' => true,
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/pay/queryexchagerate')->post([
'xml' => [
'appid' => 'wxd678efh567hg6787',
'mch_id' => '1230000109',
'fee_type' => 'USD',
'date' => '20150807',
],
'nonceless' => true,
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/pay/queryexchagerate']->post([
'xml' => [
'appid' => 'wxd678efh567hg6787',
'mch_id' => '1230000109',
'fee_type' => 'USD',
'date' => '20150807',
],
'nonceless' => true,
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典 | 类型 | 描述 |
---|---|---|
return_code | string | 返回状态码 |
return_msg | string | 返回信息 |
appid | string | 公众账号ID |
mch_id | string | 商户号 |
sub_mch_id | string | 子商户号 |
fee_type | string | 币种 |
rate_time | string | 汇率时间 |
rate | string | 现汇卖出价(汇率) |
sign | string | 签名 |
参阅 官方文档