Skip to content

APP支付下单

通过本接口提交微信支付APP支付订单

请求参数类型描述
base_uristring声明接入点https://apihk.mch.weixin.qq.com/(香港接入)
jsonobject声明请求的JSON数据结构
mchidstring商户号
appidstringAPPID
sub_mchidstring子商户号
sp_mchidstring机构商户号
sp_appidstring机构APPID
sub_appidstring子商户APPID
descriptionstring商品描述
attachstring商户数据
notify_urlstring通知地址
out_trade_nostring商户订单号
goods_tagstring商品标记
trade_typestring交易类型
limit_paystring指定支付方式
time_startstring交易起始时间
time_expirestring交易结束时间
merchant_category_codestringMCC码
payerobject支付者
openidstring用户标识
sp_openidstring用户标识(机构)
sub_openidstring用户标识(特约商户)
amountobject订单金额
totalinteger总金额
currencystring货币类型
scene_infoobject场景信息
device_idstring商户端设备号
device_ipstring商户端设备IP
payer_client_ipstring用户终端IP
operator_idstring操作员ID
store_infoobject商户门店信息
idstring编号
namestring名称
addressstring详细地址
detailobject[]优惠功能
cost_priceinteger订单原价
receipt_idstring商品小票ID
goods_detailobject[]单品列表
goods_idstring商品编码
wxpay_goods_idstring微信侧商品编码
goods_namestring商品名称
quantityinteger商品数量
priceinteger商品单价
php
$instance->v3->global->transactions->app->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' => 'APP',
    '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/app')->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' => 'APP',
    '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/app']->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' => 'APP',
    '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->app->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' => 'APP',
    '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/app')->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' => 'APP',
    '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/app']->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' => 'APP',
    '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));
返回字典类型描述
prepay_idstring预支付交易会话标识

参阅 官方文档

Published on the GitHub by TheNorthMemory