付款码支付
收银员使用扫码设备读取微信用户付款码以后,二维码或条码信息会传送至商户收银台,由商户收银台或者商户后台调用该接口发起支付。
请求参数 | 类型 | 描述 |
---|---|---|
json | object | 声明请求的JSON 数据结构 |
appid | string | 应用AppID |
mchid | string | 直连商户号 |
description | string | 商品描述 |
out_trade_no | string | 商户订单号 |
attach | string | 附加数据 |
goods_tag | string | 订单优惠标记 |
support_fapiao | boolean | 电子发票入口开放标识 |
payer | object | 支付者 |
auth_code | string | 授权码 |
amount | object | 订单金额 |
total | number | 总金额 |
currency | string | 货币类型 |
scene_info | object | 场景信息 |
device_id | string | 商户端设备号 |
device_ip | string | 商户端设备 IP |
store_info | object | 商户门店信息 |
id | string | 门店编号 |
out_id | string | 商家自定义编码 |
detail | object | 优惠功能 |
cost_price | number | 订单原价 |
invoice_id | string | 商品小票ID |
goods_detail | object[] | 单品列表 |
merchant_goods_id | string | 商品编码 |
wxpay_goods_id | string | 微信支付商品编码 |
goods_name | string | 商品名称 |
quantity | number | 商品数量 |
unit_price | number | 商品单价 |
settle_info | object | 结算信息 |
profit_sharing | boolean | 是否指定分账 |
php
$instance->v3->pay->transactions->codepay->postAsync([
'json' => [
'appid' => 'wxd678efh567hg6787',
'mchid' => '1230000109',
'description' => 'Image形象店-深圳腾大-QQ公仔',
'out_trade_no' => '1217752501201407033233368018',
'attach' => '自定义数据说明',
'goods_tag' => 'WXG',
'support_fapiao' => true,
'payer' => [
'auth_code' => '130061098828009406',
],
'amount' => [
'total' => 100,
'currency' => 'CNY',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'store_info' => [
'id' => '0001',
'out_id' => 'A1111',
],
],
'detail' => [
'cost_price' => 608800,
'invoice_id' => '微信123',
'goods_detail' => [[
'merchant_goods_id' => '1246464644',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhoneX 256G',
'quantity' => 1,
'unit_price' => 528800,
],],
],
'settle_info' => [
'profit_sharing' => true,
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/pay/transactions/codepay')->postAsync([
'json' => [
'appid' => 'wxd678efh567hg6787',
'mchid' => '1230000109',
'description' => 'Image形象店-深圳腾大-QQ公仔',
'out_trade_no' => '1217752501201407033233368018',
'attach' => '自定义数据说明',
'goods_tag' => 'WXG',
'support_fapiao' => true,
'payer' => [
'auth_code' => '130061098828009406',
],
'amount' => [
'total' => 100,
'currency' => 'CNY',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'store_info' => [
'id' => '0001',
'out_id' => 'A1111',
],
],
'detail' => [
'cost_price' => 608800,
'invoice_id' => '微信123',
'goods_detail' => [[
'merchant_goods_id' => '1246464644',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhoneX 256G',
'quantity' => 1,
'unit_price' => 528800,
],],
],
'settle_info' => [
'profit_sharing' => true,
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/pay/transactions/codepay']->postAsync([
'json' => [
'appid' => 'wxd678efh567hg6787',
'mchid' => '1230000109',
'description' => 'Image形象店-深圳腾大-QQ公仔',
'out_trade_no' => '1217752501201407033233368018',
'attach' => '自定义数据说明',
'goods_tag' => 'WXG',
'support_fapiao' => true,
'payer' => [
'auth_code' => '130061098828009406',
],
'amount' => [
'total' => 100,
'currency' => 'CNY',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'store_info' => [
'id' => '0001',
'out_id' => 'A1111',
],
],
'detail' => [
'cost_price' => 608800,
'invoice_id' => '微信123',
'goods_detail' => [[
'merchant_goods_id' => '1246464644',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhoneX 256G',
'quantity' => 1,
'unit_price' => 528800,
],],
],
'settle_info' => [
'profit_sharing' => true,
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->pay->transactions->codepay->post([
'json' => [
'appid' => 'wxd678efh567hg6787',
'mchid' => '1230000109',
'description' => 'Image形象店-深圳腾大-QQ公仔',
'out_trade_no' => '1217752501201407033233368018',
'attach' => '自定义数据说明',
'goods_tag' => 'WXG',
'support_fapiao' => true,
'payer' => [
'auth_code' => '130061098828009406',
],
'amount' => [
'total' => 100,
'currency' => 'CNY',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'store_info' => [
'id' => '0001',
'out_id' => 'A1111',
],
],
'detail' => [
'cost_price' => 608800,
'invoice_id' => '微信123',
'goods_detail' => [[
'merchant_goods_id' => '1246464644',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhoneX 256G',
'quantity' => 1,
'unit_price' => 528800,
],],
],
'settle_info' => [
'profit_sharing' => true,
],
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/pay/transactions/codepay')->post([
'json' => [
'appid' => 'wxd678efh567hg6787',
'mchid' => '1230000109',
'description' => 'Image形象店-深圳腾大-QQ公仔',
'out_trade_no' => '1217752501201407033233368018',
'attach' => '自定义数据说明',
'goods_tag' => 'WXG',
'support_fapiao' => true,
'payer' => [
'auth_code' => '130061098828009406',
],
'amount' => [
'total' => 100,
'currency' => 'CNY',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'store_info' => [
'id' => '0001',
'out_id' => 'A1111',
],
],
'detail' => [
'cost_price' => 608800,
'invoice_id' => '微信123',
'goods_detail' => [[
'merchant_goods_id' => '1246464644',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhoneX 256G',
'quantity' => 1,
'unit_price' => 528800,
],],
],
'settle_info' => [
'profit_sharing' => true,
],
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/pay/transactions/codepay']->post([
'json' => [
'appid' => 'wxd678efh567hg6787',
'mchid' => '1230000109',
'description' => 'Image形象店-深圳腾大-QQ公仔',
'out_trade_no' => '1217752501201407033233368018',
'attach' => '自定义数据说明',
'goods_tag' => 'WXG',
'support_fapiao' => true,
'payer' => [
'auth_code' => '130061098828009406',
],
'amount' => [
'total' => 100,
'currency' => 'CNY',
],
'scene_info' => [
'device_id' => '013467007045764',
'device_ip' => '128.0.0.1',
'store_info' => [
'id' => '0001',
'out_id' => 'A1111',
],
],
'detail' => [
'cost_price' => 608800,
'invoice_id' => '微信123',
'goods_detail' => [[
'merchant_goods_id' => '1246464644',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhoneX 256G',
'quantity' => 1,
'unit_price' => 528800,
],],
],
'settle_info' => [
'profit_sharing' => true,
],
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
appid | string | 应用AppID |
mchid | string | 直连商户号 |
out_trade_no | string | 商户订单号 |
transaction_id | string | 微信支付订单号 |
trade_type | string | 交易类型 |
bank_type | string | 银行类型 |
success_time | string | 支付完成时间 |
trade_state | string | 交易状态 |
trade_state_desc | string | 交易状态描述 |
attach | string | 附加数据 |
payer | object | 支付者 |
openid | string | 用户标识 |
amount | object | 订单金额 |
total | number | 订单金额 |
payer_total | number | 用户支付金额 |
currency | string | 订单金额货币类型 |
payer_currency | string | 用户支付货币类型 |
promotion_detail | object[] | 优惠信息 |
coupon_id | string | 券ID |
name | string | 优惠名称 |
scope | string | 优惠范围 |
type | string | 优惠类型 |
amount | number | 优惠券面额 |
stock_id | string | 活动ID |
wechatpay_contribute | number | 微信出资 |
merchant_contribute | number | 商户出资 |
other_contribute | number | 其他出资 |
currency | string | 优惠货币类型 |
goods_detail | object[] | 单品列表 |
goods_id | string | 商品编码 |
quantity | number | 商品数量 |
unit_price | number | 商品单价 |
discount_amount | number | 商品优惠金额 |
goods_remark | string | 商品备注 |
参阅 官方文档