Native支付下单
通过本接口提交微信支付扫码支付订单
| 请求参数 | 类型 | 描述 |
|---|---|---|
| base_uri | string | 声明接入点https://apihk.mch.weixin.qq.com/(香港接入) |
| 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 | 商户数据 |
| notify_url | string | 通知地址 |
| out_trade_no | string | 商户订单号 |
| goods_tag | string | 商品标记 |
| trade_type | string | 交易类型 |
| limit_pay | string | 指定支付方式 |
| time_start | string | 交易起始时间 |
| time_expire | string | 交易结束时间 |
| merchant_category_code | string | MCC码 |
| payer | object | 支付者 |
| openid | string | 用户标识 |
| sp_openid | string | 用户标识(机构) |
| sub_openid | 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->global->transactions->native->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => '',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'NATIVE',
'limit_pay' => 'no_credit',
'time_start' => '2018-06-08T10:34:56+08:00',
'time_expire' => '2018-06-08T10:34:56+08:00',
'merchant_category_code' => '1011',
'payer' => [
'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sp_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sub_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
],
'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' => '12345',
'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/global/transactions/native')->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => '',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'NATIVE',
'limit_pay' => 'no_credit',
'time_start' => '2018-06-08T10:34:56+08:00',
'time_expire' => '2018-06-08T10:34:56+08:00',
'merchant_category_code' => '1011',
'payer' => [
'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sp_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sub_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
],
'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' => '12345',
'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/global/transactions/native']->postAsync([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => '',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'NATIVE',
'limit_pay' => 'no_credit',
'time_start' => '2018-06-08T10:34:56+08:00',
'time_expire' => '2018-06-08T10:34:56+08:00',
'merchant_category_code' => '1011',
'payer' => [
'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sp_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sub_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
],
'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' => '12345',
'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->global->transactions->native->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => '',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'NATIVE',
'limit_pay' => 'no_credit',
'time_start' => '2018-06-08T10:34:56+08:00',
'time_expire' => '2018-06-08T10:34:56+08:00',
'merchant_category_code' => '1011',
'payer' => [
'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sp_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sub_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
],
'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' => '12345',
'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/global/transactions/native')->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => '',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'NATIVE',
'limit_pay' => 'no_credit',
'time_start' => '2018-06-08T10:34:56+08:00',
'time_expire' => '2018-06-08T10:34:56+08:00',
'merchant_category_code' => '1011',
'payer' => [
'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sp_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sub_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
],
'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' => '12345',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'quantity' => 1,
'price' => 528800,
],],
],],
],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/global/transactions/native']->post([
'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
'json' => [
'mchid' => '1900000109',
'appid' => 'wx8888888888888888',
'sub_mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sp_appid' => 'wx8888888888888888',
'sub_appid' => '',
'description' => 'image形象店-深圳腾大- QQ公仔',
'attach' => '自定义数据',
'notify_url' => 'https://www.weixin.qq.com/wxpay/pay.php',
'out_trade_no' => '1217752501201407033233368018',
'goods_tag' => 'WXG',
'trade_type' => 'NATIVE',
'limit_pay' => 'no_credit',
'time_start' => '2018-06-08T10:34:56+08:00',
'time_expire' => '2018-06-08T10:34:56+08:00',
'merchant_category_code' => '1011',
'payer' => [
'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sp_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'sub_openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
],
'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' => '12345',
'wxpay_goods_id' => '1001',
'goods_name' => 'iPhone6s 16G',
'quantity' => 1,
'price' => 528800,
],],
],],
],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 |
|---|---|---|
| code_url | string | 二维码链接 |
参阅 官方文档