Skip to content

提交付款码支付

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

请求参数类型描述
xmlobject声明请求的XML数据结构
versionstring接口版本号
profit_sharingstring是否指定服务商分账;Y-是,需要分账;N-否,不分账;字母要求大写,不传默认不分账
N | Y 枚举值之一
depositstring是否押金支付
Y | N 枚举值之一
appidstring公众账号ID
sub_appidstring子商户公众账号ID
mch_idstring商户号
sub_mch_idstring子商户号
device_infostring设备号
sign_typestring签名类型
bodystring商品描述
detailstring单品优惠活动该字段必传,且必须按照规范上传,JSON格式
attachstring附加数据
out_trade_nostring商户订单号
total_feeinteger订单金额
fee_typestring货币类型
spbill_create_ipstring终端IP
goods_tagstring订单优惠标记
limit_paystring指定支付方式
time_startstring交易起始时间
time_expirestring交易结束时间
receiptstring电子发票入口开放标识
auth_codestring授权码
scene_infostring+场景信息
php
$instance->v2->pay->micropay->postAsync([
  'xml' => [
    'version' => '1.0',
    'profit_sharing' => 'N',
    'deposit' => 'Y',
    'appid' => 'wx8888888888888888',
    'sub_appid' => 'wx8888888888888888',
    'mch_id' => '1900000109',
    'sub_mch_id' => '1900000100',
    'device_info' => '013467007045764',
    'sign_type' => 'HMAC-SHA256',
    'body' => 'image形象店-深圳腾大- QQ公仔',
    'detail' => '{"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"商品编码","wxpay_goods_id":"1001","goods_name":"iPhone6s 16G","quantity":1,"price":1},{"goods_id":"商品编码","wxpay_goods_id":"1002","goods_name":"iPhone6s 32G","quantity":1,"price":1}]}',
    'attach' => '说明',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => '1234',
    'limit_pay' => 'no_credit',
    'time_start' => '20091225091010',
    'time_expire' => '20091227091010',
    'receipt' => 'Y',
    'auth_code' => '120061098828009406',
    'scene_info' => '{"store_info" : {"id": "SZTX001","name": "腾大餐厅","area_code": "440305","address": "科技园中一路腾讯大厦" }}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/pay/micropay')->postAsync([
  'xml' => [
    'version' => '1.0',
    'profit_sharing' => 'N',
    'deposit' => 'Y',
    'appid' => 'wx8888888888888888',
    'sub_appid' => 'wx8888888888888888',
    'mch_id' => '1900000109',
    'sub_mch_id' => '1900000100',
    'device_info' => '013467007045764',
    'sign_type' => 'HMAC-SHA256',
    'body' => 'image形象店-深圳腾大- QQ公仔',
    'detail' => '{"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"商品编码","wxpay_goods_id":"1001","goods_name":"iPhone6s 16G","quantity":1,"price":1},{"goods_id":"商品编码","wxpay_goods_id":"1002","goods_name":"iPhone6s 32G","quantity":1,"price":1}]}',
    'attach' => '说明',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => '1234',
    'limit_pay' => 'no_credit',
    'time_start' => '20091225091010',
    'time_expire' => '20091227091010',
    'receipt' => 'Y',
    'auth_code' => '120061098828009406',
    'scene_info' => '{"store_info" : {"id": "SZTX001","name": "腾大餐厅","area_code": "440305","address": "科技园中一路腾讯大厦" }}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/pay/micropay']->postAsync([
  'xml' => [
    'version' => '1.0',
    'profit_sharing' => 'N',
    'deposit' => 'Y',
    'appid' => 'wx8888888888888888',
    'sub_appid' => 'wx8888888888888888',
    'mch_id' => '1900000109',
    'sub_mch_id' => '1900000100',
    'device_info' => '013467007045764',
    'sign_type' => 'HMAC-SHA256',
    'body' => 'image形象店-深圳腾大- QQ公仔',
    'detail' => '{"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"商品编码","wxpay_goods_id":"1001","goods_name":"iPhone6s 16G","quantity":1,"price":1},{"goods_id":"商品编码","wxpay_goods_id":"1002","goods_name":"iPhone6s 32G","quantity":1,"price":1}]}',
    'attach' => '说明',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => '1234',
    'limit_pay' => 'no_credit',
    'time_start' => '20091225091010',
    'time_expire' => '20091227091010',
    'receipt' => 'Y',
    'auth_code' => '120061098828009406',
    'scene_info' => '{"store_info" : {"id": "SZTX001","name": "腾大餐厅","area_code": "440305","address": "科技园中一路腾讯大厦" }}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->pay->micropay->post([
  'xml' => [
    'version' => '1.0',
    'profit_sharing' => 'N',
    'deposit' => 'Y',
    'appid' => 'wx8888888888888888',
    'sub_appid' => 'wx8888888888888888',
    'mch_id' => '1900000109',
    'sub_mch_id' => '1900000100',
    'device_info' => '013467007045764',
    'sign_type' => 'HMAC-SHA256',
    'body' => 'image形象店-深圳腾大- QQ公仔',
    'detail' => '{"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"商品编码","wxpay_goods_id":"1001","goods_name":"iPhone6s 16G","quantity":1,"price":1},{"goods_id":"商品编码","wxpay_goods_id":"1002","goods_name":"iPhone6s 32G","quantity":1,"price":1}]}',
    'attach' => '说明',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => '1234',
    'limit_pay' => 'no_credit',
    'time_start' => '20091225091010',
    'time_expire' => '20091227091010',
    'receipt' => 'Y',
    'auth_code' => '120061098828009406',
    'scene_info' => '{"store_info" : {"id": "SZTX001","name": "腾大餐厅","area_code": "440305","address": "科技园中一路腾讯大厦" }}',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/pay/micropay')->post([
  'xml' => [
    'version' => '1.0',
    'profit_sharing' => 'N',
    'deposit' => 'Y',
    'appid' => 'wx8888888888888888',
    'sub_appid' => 'wx8888888888888888',
    'mch_id' => '1900000109',
    'sub_mch_id' => '1900000100',
    'device_info' => '013467007045764',
    'sign_type' => 'HMAC-SHA256',
    'body' => 'image形象店-深圳腾大- QQ公仔',
    'detail' => '{"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"商品编码","wxpay_goods_id":"1001","goods_name":"iPhone6s 16G","quantity":1,"price":1},{"goods_id":"商品编码","wxpay_goods_id":"1002","goods_name":"iPhone6s 32G","quantity":1,"price":1}]}',
    'attach' => '说明',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => '1234',
    'limit_pay' => 'no_credit',
    'time_start' => '20091225091010',
    'time_expire' => '20091227091010',
    'receipt' => 'Y',
    'auth_code' => '120061098828009406',
    'scene_info' => '{"store_info" : {"id": "SZTX001","name": "腾大餐厅","area_code": "440305","address": "科技园中一路腾讯大厦" }}',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/pay/micropay']->post([
  'xml' => [
    'version' => '1.0',
    'profit_sharing' => 'N',
    'deposit' => 'Y',
    'appid' => 'wx8888888888888888',
    'sub_appid' => 'wx8888888888888888',
    'mch_id' => '1900000109',
    'sub_mch_id' => '1900000100',
    'device_info' => '013467007045764',
    'sign_type' => 'HMAC-SHA256',
    'body' => 'image形象店-深圳腾大- QQ公仔',
    'detail' => '{"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"商品编码","wxpay_goods_id":"1001","goods_name":"iPhone6s 16G","quantity":1,"price":1},{"goods_id":"商品编码","wxpay_goods_id":"1002","goods_name":"iPhone6s 32G","quantity":1,"price":1}]}',
    'attach' => '说明',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => '1234',
    'limit_pay' => 'no_credit',
    'time_start' => '20091225091010',
    'time_expire' => '20091227091010',
    'receipt' => 'Y',
    'auth_code' => '120061098828009406',
    'scene_info' => '{"store_info" : {"id": "SZTX001","name": "腾大餐厅","area_code": "440305","address": "科技园中一路腾讯大厦" }}',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
return_msgstring返回信息
appidstring公众账号ID
sub_appidstring子商户公众账号ID
mch_idstring商户号
sub_mch_idstring子商户号
device_infostring设备号
nonce_strstring随机字符串
signstring签名
result_codestring业务结果
err_codestring错误代码
err_code_desstring错误代码描述
openidstring用户标识
is_subscribestring是否关注公众账号
trade_typestring交易类型
bank_typestring付款银行
fee_typestring货币类型
total_feeinteger订单金额
settlement_total_feeinteger应结订单金额
coupon_feeinteger代金券金额
cash_fee_typestring现金支付货币类型
cash_feeinteger现金支付金额
transaction_idstring微信支付订单号
out_trade_nostring商户订单号
attachstring商家数据包
time_endstring支付完成时间
promotion_detailstring营销详情

参阅 官方文档

Published on the GitHub by TheNorthMemory