Skip to content

交易保障

商户在调用微信支付提供的相关接口时,会得到微信支付返回的相关信息以及获得整个接口的响应时间。为提高整体的服务水平,协助商户一起提高服务质量,微信支付提供了相关接口调用耗时和返回信息的主动上报接口,微信支付可以根据商户侧上报的数据进一步优化网络部署,完善服务监控,和商户更好的协作为用户提供更好的业务体验。

请求参数类型描述
xmlobject声明请求的XML数据结构
appidstring公众账号ID
mch_idstring商户号
device_infostring设备号
interface_urlstring接口URL
user_ipstring访问接口IP
tradesstring上报数据包JSON格式字符串
transactionobject[]交易数据
out_trade_nostring商户订单号
begin_timestring交易开始时间(扫码时间)
end_timestring交易完成时间
statestring交易结果
OK | FAIL | CANCLE 枚举值之一
err_msgstring自定义的错误描述信息
php
$instance->v2->payitil->report->postAsync([
  'xml' => [
    'appid'         => 'wx8888888888888888',
    'mch_id'        => '1900000109',
    'device_info'   => '013467007045764',
    'interface_url' => 'https://api.mch.weixin.qq.com/pay/batchreport/micropay/total',
    'user_ip'       => '8.8.8.8',
    'trades'        => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/payitil/report')->postAsync([
  'xml' => [
    'appid'         => 'wx8888888888888888',
    'mch_id'        => '1900000109',
    'device_info'   => '013467007045764',
    'interface_url' => 'https://api.mch.weixin.qq.com/pay/batchreport/micropay/total',
    'user_ip'       => '8.8.8.8',
    'trades'        => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/payitil/report']->postAsync([
  'xml' => [
    'appid'         => 'wx8888888888888888',
    'mch_id'        => '1900000109',
    'device_info'   => '013467007045764',
    'interface_url' => 'https://api.mch.weixin.qq.com/pay/batchreport/micropay/total',
    'user_ip'       => '8.8.8.8',
    'trades'        => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->payitil->report->post([
  'xml' => [
    'appid'         => 'wx8888888888888888',
    'mch_id'        => '1900000109',
    'device_info'   => '013467007045764',
    'interface_url' => 'https://api.mch.weixin.qq.com/pay/batchreport/micropay/total',
    'user_ip'       => '8.8.8.8',
    'trades'        => '',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/payitil/report')->post([
  'xml' => [
    'appid'         => 'wx8888888888888888',
    'mch_id'        => '1900000109',
    'device_info'   => '013467007045764',
    'interface_url' => 'https://api.mch.weixin.qq.com/pay/batchreport/micropay/total',
    'user_ip'       => '8.8.8.8',
    'trades'        => '',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/payitil/report']->post([
  'xml' => [
    'appid'         => 'wx8888888888888888',
    'mch_id'        => '1900000109',
    'device_info'   => '013467007045764',
    'interface_url' => 'https://api.mch.weixin.qq.com/pay/batchreport/micropay/total',
    'user_ip'       => '8.8.8.8',
    'trades'        => '',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
result_codestring业务结果
SUCCESS | FAIL 枚举值之一

参阅 官方付款码文档 官方JSAPI文档 官方NATIVE文档 官方APP文档 官方H5文档 官方小程序支付文档

Published on the GitHub by TheNorthMemory