Skip to content

付款码支付

收银员使用扫码设备读取微信用户付款码以后,二维码或条码信息会传送至商户收银台,由商户收银台或者商户后台调用该接口发起支付。

请求参数类型描述
jsonobject声明请求的JSON数据结构
sp_appidstring合作伙伴应用AppID
sp_mchidstring合作伙伴商户号
sub_appidstring特约商户应用AppID
sub_mchidstring特约商户商户号
descriptionstring商品描述
out_trade_nostring商户订单号
attachstring附加数据
goods_tagstring订单优惠标记
support_fapiaoboolean电子发票入口开放标识
payerobject支付者
auth_codestring授权码
amountobject订单金额
totalnumber总金额
currencystring货币类型
scene_infoobject场景信息
device_idstring商户端设备号
device_ipstring商户端设备 IP
store_infoobject商户门店信息
idstring门店编号
out_idstring商家自定义编码
detailobject优惠功能
cost_pricenumber订单原价
invoice_idstring商品小票ID
goods_detailobject[]单品列表
merchant_goods_idstring商品编码
wxpay_goods_idstring微信支付商品编码
goods_namestring商品名称
quantitynumber商品数量
unit_pricenumber商品单价
settle_infoobject结算信息
profit_sharingboolean是否指定分账
php
$instance->v3->pay->partner->transactions->codepay->postAsync([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sp_mchid' => '1230000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'sub_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/partner/transactions/codepay')->postAsync([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sp_mchid' => '1230000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'sub_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/partner/transactions/codepay']->postAsync([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sp_mchid' => '1230000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'sub_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->partner->transactions->codepay->post([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sp_mchid' => '1230000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'sub_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/partner/transactions/codepay')->post([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sp_mchid' => '1230000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'sub_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/partner/transactions/codepay']->post([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sp_mchid' => '1230000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'sub_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));
返回字典类型描述
sp_appidstring合作伙伴应用AppID
sp_mchidstring合作伙伴商户号
sub_appidstring特约商户应用AppID
sub_mchidstring特约商户商户号
out_trade_nostring商户订单号
transaction_idstring微信支付订单号
trade_typestring交易类型
bank_typestring银行类型
success_timestring支付完成时间
trade_statestring交易状态
trade_state_descstring交易状态描述
attachstring附加数据
payerobject支付者
sp_openidstring合作伙伴用户标识
sub_openidstring特约商户用户标识
amountobject订单金额
totalnumber订单金额
payer_totalnumber用户支付金额
currencystring订单金额货币类型
payer_currencystring用户支付货币类型
promotion_detailobject[]优惠信息
coupon_idstring券ID
namestring优惠名称
scopestring优惠范围
typestring优惠类型
amountnumber优惠券面额
stock_idstring活动ID
wechatpay_contributenumber微信出资
merchant_contributenumber商户出资
other_contributenumber其他出资
currencystring优惠货币类型
goods_detailobject[]单品列表
goods_idstring商品编码
quantitynumber商品数量
unit_pricenumber商品单价
discount_amountnumber商品优惠金额
goods_remarkstring商品备注

参阅 官方文档

Published on the GitHub by TheNorthMemory