支付扣款
可应用于定期扣款或需事后扣款以期提高效率的场景。例如:水电煤缴费、话费、充电宝租借等场景。
| 请求参数 | 类型 | 描述 |
|---|---|---|
| base_uri | string | 声明接入点https://apihk.mch.weixin.qq.com/(香港接入) |
| json | object | 声明请求的JSON数据结构 |
| appid | string | 机构APPID |
| sp_appid | string | 机构appid |
| sub_mchid | string | 子商户号 |
| sub_appid | string | 子商户应用ID |
| description | string | 商品描述 |
| attach | string | 商户数据 |
| notify_url | string | 通知地址 |
| out_trade_no | string | 商户订单号 |
| goods_tag | string | 商品标记 |
| merchant_category_code | string | MCC码 |
| contract_id | string | 委托代扣协议ID |
| amount | object | 订单金额 |
| total | integer | 总金额 |
| currency | string | 货币类型 |
| scene_info | object | 场景信息 |
| device_id | string | 商户端设备号 |
| device_ip | string | 商户端设备IP |
php
$instance->v3->global->papay->transactions->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'appid' => 'wxd678efh567hg6787',
'sp_appid' => 'wx8888888888888888',
'sub_mchid' => '1230000109',
'sub_appid' => 'wxcbda96de0b165484',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'merchant_category_code' => '1011',
'contract_id' => '100005698',
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance->chain('v3/global/papay/transactions')->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'appid' => 'wxd678efh567hg6787',
'sp_appid' => 'wx8888888888888888',
'sub_mchid' => '1230000109',
'sub_appid' => 'wxcbda96de0b165484',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'merchant_category_code' => '1011',
'contract_id' => '100005698',
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance['v3/global/papay/transactions']->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'appid' => 'wxd678efh567hg6787',
'sp_appid' => 'wx8888888888888888',
'sub_mchid' => '1230000109',
'sub_appid' => 'wxcbda96de0b165484',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'merchant_category_code' => '1011',
'contract_id' => '100005698',
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$response = $instance->v3->global->papay->transactions->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'appid' => 'wxd678efh567hg6787',
'sp_appid' => 'wx8888888888888888',
'sub_mchid' => '1230000109',
'sub_appid' => 'wxcbda96de0b165484',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'merchant_category_code' => '1011',
'contract_id' => '100005698',
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance->chain('v3/global/papay/transactions')->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'appid' => 'wxd678efh567hg6787',
'sp_appid' => 'wx8888888888888888',
'sub_mchid' => '1230000109',
'sub_appid' => 'wxcbda96de0b165484',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'merchant_category_code' => '1011',
'contract_id' => '100005698',
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/global/papay/transactions']->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'appid' => 'wxd678efh567hg6787',
'sp_appid' => 'wx8888888888888888',
'sub_mchid' => '1230000109',
'sub_appid' => 'wxcbda96de0b165484',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'merchant_category_code' => '1011',
'contract_id' => '100005698',
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 |
|---|---|---|
| mchid | string | 商户号 |
| appid | string | APPID |
| sp_mchid | string | 机构商户号 |
| sub_mchid | string | 子商户号 |
| sp_appid | string | 机构APPID |
| sub_appid | string | 子商户APPID |
| out_trade_no | string | 商户订单号 |
| transaction_id | string | 微信支付订单号 |
| attach | string | 商户数据 |
| trade_type | string | 交易类型AUTH 枚举值 |
| bank_type | string | 付款银行 |
| success_time | string | 支付完成时间 |
| trade_state | string | 交易状态SUCCESS | REFUND | NOTPAY | CLOSED | PAYERROR | USERPAYING 枚举值之一 |
| trade_state_desc | string | 交易状态描述 |
| payer | object | 支付者 |
| openid | string | 用户标识 |
| sp_openid | string | 机构用户标识 |
| sub_openid | string | 子商户用户标识 |
| amount | object | 订单金额 |
| total | integer | 订单金额 |
| payer_total | integer | 用户支付金额 |
| currency | string | 订单标价币种 |
| payer_currency | string | 用户支付币种 |
| exchange_rate | object | 汇率信息 |
| type | string | 汇率类型SETTLEMENT_RATE | USERPAYMENT_RATE 枚举值之一 |
| rate | integer | 汇率值 |
| promotion_detail | object[] | 优惠功能 |
| promotion_id | string | 券ID |
| name | string | 优惠名称 |
| scope | string | 优惠范围GLOBAL | SINGLE 枚举值之一 |
| type | string | 优惠类型COUPON | DISCOUNT 枚举值之一 |
| amount | integer | 优惠券面额 |
| currency | string | 优惠币种 |
| activity_id | string | 活动ID |
| wxpay_contribute_amount | integer | 微信出资 |
| merchant_contribute_amount | integer | 商户出资 |
| other_contribute_amount | integer | 其他出资 |
| goods_detail | object[] | 单品列表 |
| goods_id | string | 商品编码 |
| goods_remark | string | 商品备注 |
| discount_amount | integer | 商品优惠金额 |
| quantity | integer | 商品数量 |
| price | integer | 商品价格 |
参阅 官方文档