提交付款码支付
通过本接口提交微信支付付款码支付订单。
🔰
本接口服务已于 2022.09.08 (北京时间)发布新版,新接口见这里,此文档仅做留存参考。
| 请求参数 | 类型 | 描述 |
|---|---|---|
| base_uri | string | 声明接入点https://api.mch.weixin.qq.com/hk/(国内接入) |
| json | object | 声明请求的JSON数据结构 |
| mchid | string | 商户号 |
| appid | string | APPID |
| sub_mchid | string | 子商户号 |
| sp_mchid | string | 机构商户号 |
| sp_appid | string | 机构APPID |
| sub_appid | string | 子商户APPID |
| description | string | 商品描述 |
| attach | string | 商户数据 |
| out_trade_no | string | 商户订单号 |
| goods_tag | string | 商品标记 |
| trade_type | string | 交易类型 |
| limit_pay | string | 指定支付方式 |
| merchant_category_code | string | MCC码 |
| payer | object | 支付者 |
| auth_code | string | 授权码 |
| amount | object | 订单金额 |
| total | integer | 总金额 |
| currency | string | 货币类型 |
| scene_info | object | 场景信息 |
| device_id | string | 商户端设备号 |
| device_ip | string | 商户端设备IP |
| payer_client_ip | string | 用户终端IP |
| operator_id | string | 操作员ID |
| store_info | object | 商户门店信息 |
| id | string | 编号 |
| name | string | 名称 |
| address | string | 详细地址 |
| detail | object[] | 优惠功能 |
| cost_price | integer | 订单原价 |
| receipt_id | string | 商品小票ID |
| goods_detail | object[] | 单品列表 |
| goods_id | string | 商品编码 |
| wxpay_goods_id | string | 微信侧商品编码 |
| goods_name | string | 商品名称 |
| quantity | integer | 商品数量 |
| price | integer | 商品单价 |
php
$instance->v3->transactions->micropay->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'MICROPAY',
'limit_pay' => 'no_credit',
'merchant_category_code' => '1011',
'payer' => [
'auth_code' => '120061098828009406',
],
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'payer_client_ip' => '128.0.0.1',
'operator_id' => '123145',
'store_info' => [
'id' => '0001',
'name' => '腾讯大厦分店',
'address' => '广东省深圳市南山区科技中一道10000号',
],
],
'detail' => [[
'cost_price' => 608800,
'receipt_id' => 'wx123',
'goods_detail' => [[
'goods_id' => '商品编码',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'quantity' => 1,
'price' => 528800,
],],
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance->chain('v3/transactions/micropay')->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'MICROPAY',
'limit_pay' => 'no_credit',
'merchant_category_code' => '1011',
'payer' => [
'auth_code' => '120061098828009406',
],
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'payer_client_ip' => '128.0.0.1',
'operator_id' => '123145',
'store_info' => [
'id' => '0001',
'name' => '腾讯大厦分店',
'address' => '广东省深圳市南山区科技中一道10000号',
],
],
'detail' => [[
'cost_price' => 608800,
'receipt_id' => 'wx123',
'goods_detail' => [[
'goods_id' => '商品编码',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'quantity' => 1,
'price' => 528800,
],],
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance['v3/transactions/micropay']->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'MICROPAY',
'limit_pay' => 'no_credit',
'merchant_category_code' => '1011',
'payer' => [
'auth_code' => '120061098828009406',
],
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'payer_client_ip' => '128.0.0.1',
'operator_id' => '123145',
'store_info' => [
'id' => '0001',
'name' => '腾讯大厦分店',
'address' => '广东省深圳市南山区科技中一道10000号',
],
],
'detail' => [[
'cost_price' => 608800,
'receipt_id' => 'wx123',
'goods_detail' => [[
'goods_id' => '商品编码',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'quantity' => 1,
'price' => 528800,
],],
],],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$response = $instance->v3->transactions->micropay->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'MICROPAY',
'limit_pay' => 'no_credit',
'merchant_category_code' => '1011',
'payer' => [
'auth_code' => '120061098828009406',
],
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'payer_client_ip' => '128.0.0.1',
'operator_id' => '123145',
'store_info' => [
'id' => '0001',
'name' => '腾讯大厦分店',
'address' => '广东省深圳市南山区科技中一道10000号',
],
],
'detail' => [[
'cost_price' => 608800,
'receipt_id' => 'wx123',
'goods_detail' => [[
'goods_id' => '商品编码',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'quantity' => 1,
'price' => 528800,
],],
],],
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance->chain('v3/transactions/micropay')->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'MICROPAY',
'limit_pay' => 'no_credit',
'merchant_category_code' => '1011',
'payer' => [
'auth_code' => '120061098828009406',
],
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'payer_client_ip' => '128.0.0.1',
'operator_id' => '123145',
'store_info' => [
'id' => '0001',
'name' => '腾讯大厦分店',
'address' => '广东省深圳市南山区科技中一道10000号',
],
],
'detail' => [[
'cost_price' => 608800,
'receipt_id' => 'wx123',
'goods_detail' => [[
'goods_id' => '商品编码',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'quantity' => 1,
'price' => 528800,
],],
],],
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/transactions/micropay']->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'MICROPAY',
'limit_pay' => 'no_credit',
'merchant_category_code' => '1011',
'payer' => [
'auth_code' => '120061098828009406',
],
'amount' => [
'total' => 888,
'currency' => 'HKD',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'payer_client_ip' => '128.0.0.1',
'operator_id' => '123145',
'store_info' => [
'id' => '0001',
'name' => '腾讯大厦分店',
'address' => '广东省深圳市南山区科技中一道10000号',
],
],
'detail' => [[
'cost_price' => 608800,
'receipt_id' => 'wx123',
'goods_detail' => [[
'goods_id' => '商品编码',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'quantity' => 1,
'price' => 528800,
],],
],],
],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 |
|---|---|---|
| id | string | 微信支付订单号 |
| mchid | string | 商户号 |
| appid | string | APPID |
| sub_mchid | string | 子商户号 |
| sp_mchid | string | 机构商户号 |
| sp_appid | string | 机构APPID |
| sub_appid | string | 子商户APPID |
| out_trade_no | string | 商户订单号 |
| trade_type | string | 交易类型JSAPI | NATIVE | APP | MWEB | MICROPAY 枚举值之一 |
| trade_state | string | 交易状态SUCCESS | REFUND | NOTPAY | CLOSED | REVOKED | USERPAYING | PAYERROR 枚举值之一 |
| trade_state_desc | string | 交易状态描述 |
| bank_type | string | 付款银行 |
| attach | string | 商户数据 |
| success_time | string | 支付完成时间 |
| payer | object | 支付者 |
| openid | string | 用户标识 |
| sp_openid | string | 用户标识(机构) |
| sub_openid | string | 用户标识(特约商户) |
| amount | object | 订单金额 |
| total | integer | 订单金额 |
| currency | string | 货币类型 |
| payer_total | integer | 用户支付金额 |
| payer _currency | string | 支付货币类型 |
| exchange_rate | object | 汇率 |
| type | string | 汇率类型SETTLEMENT_RATE 枚举值 |
| rate | integer | 汇率值 |
| detail | object[] | 优惠功能 |
| promotion_id | string | 券ID |
| name | string | 优惠名称 |
| scope | string | 优惠范围GLOBAL | SINGLE 枚举值之一 |
| type | string | 优惠类型COUPON | DISCOUNT 枚举值之一 |
| amount | integer | 优惠券面额 |
| currency | string | 货币类型 |
| activity_id | string | 活动ID |
| wechatpay_contribute_amount | integer | 微信出资 |
| merchant_contribute_amount | integer | 商户出资 |
| other_contribute_amount | integer | 其他出资 |
| goods_detail | object[] | 单品列表 |
| goods_id | string | 商品编码 |
| goods_remark | string | 商品备注 |
| quantity | integer | 商品数量 |
| price | integer | 商品价格 |
参阅 官方文档