Skip to content

普通商户创建及查询微信先享后付订单信息

创建先享后付订单

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring公众账号ID
out_order_nostring商户服务订单号
service_idstring服务ID
service_start_timestring用户下单时确认的服务开始时间
service_end_timestring用户下单时确定的预计服务结束时间
service_start_locationstring开始使用服务的地点
service_end_locationstring预计服务结束的地点
service_introductionstring服务信息,用于介绍本订单所提供的服务
feesobject[]后付费,描述付费项目列表
fee_namestring付费项目名称
fee_countinteger付费项目数量
fee_amountinteger付费项目总金额
fee_descstring描述计费规则
discountsobject[]商户优惠,最多包含5条商户优惠
discount_namestring优惠名称
discount_descstring优惠说明
risk_amountinteger订单风险金额
attachstring商户自定义说明,可存放本订单所需信息
need_user_confirmboolean使用需用户确认订单类型
openidstring微信用户在商户对应appid下的唯一标识
namestring用户姓名
phonestring用户手机号
useridstring用户身份证ID
addressstring用户收货地址
headersobject声明请求的头参数
Wechatpay-Serialstring平台公钥ID/平台公钥证书序列号
php
$instance->v3->payscore->payafterOrders->postAsync([
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'out_order_no'           => '1234323JKHDFE1243252',
    'service_id'             => '500001',
    'service_start_time'     => '',
    'service_end_time'       => '',
    'service_start_location' => '',
    'service_end_location'   => '',
    'service_introduction'   => '',
    'fees'                   => [[
      'fee_name'   => '',
      'fee_count'  => 0,
      'fee_amount' => 0,
      'fee_desc'   => '',
    ],],
    'discounts'              => [[
      'discount_name' => '满20减1元',
      'discount_desc' => '不与其他优惠叠加',
    ],],
    'risk_amount'            => 0,
    'attach'                 => '',
    'need_user_confirm'      => true,
    'openid'                 => '',
    'name'                   => '',
    'phone'                  => '',
    'userid'                 => '',
    'address'                => '',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/payscore/payafter-orders')->postAsync([
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'out_order_no'           => '1234323JKHDFE1243252',
    'service_id'             => '500001',
    'service_start_time'     => '',
    'service_end_time'       => '',
    'service_start_location' => '',
    'service_end_location'   => '',
    'service_introduction'   => '',
    'fees'                   => [[
      'fee_name'   => '',
      'fee_count'  => 0,
      'fee_amount' => 0,
      'fee_desc'   => '',
    ],],
    'discounts'              => [[
      'discount_name' => '满20减1元',
      'discount_desc' => '不与其他优惠叠加',
    ],],
    'risk_amount'            => 0,
    'attach'                 => '',
    'need_user_confirm'      => true,
    'openid'                 => '',
    'name'                   => '',
    'phone'                  => '',
    'userid'                 => '',
    'address'                => '',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/payscore/payafter-orders']->postAsync([
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'out_order_no'           => '1234323JKHDFE1243252',
    'service_id'             => '500001',
    'service_start_time'     => '',
    'service_end_time'       => '',
    'service_start_location' => '',
    'service_end_location'   => '',
    'service_introduction'   => '',
    'fees'                   => [[
      'fee_name'   => '',
      'fee_count'  => 0,
      'fee_amount' => 0,
      'fee_desc'   => '',
    ],],
    'discounts'              => [[
      'discount_name' => '满20减1元',
      'discount_desc' => '不与其他优惠叠加',
    ],],
    'risk_amount'            => 0,
    'attach'                 => '',
    'need_user_confirm'      => true,
    'openid'                 => '',
    'name'                   => '',
    'phone'                  => '',
    'userid'                 => '',
    'address'                => '',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->payscore->payafterOrders->post([
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'out_order_no'           => '1234323JKHDFE1243252',
    'service_id'             => '500001',
    'service_start_time'     => '',
    'service_end_time'       => '',
    'service_start_location' => '',
    'service_end_location'   => '',
    'service_introduction'   => '',
    'fees'                   => [[
      'fee_name'   => '',
      'fee_count'  => 0,
      'fee_amount' => 0,
      'fee_desc'   => '',
    ],],
    'discounts'              => [[
      'discount_name' => '满20减1元',
      'discount_desc' => '不与其他优惠叠加',
    ],],
    'risk_amount'            => 0,
    'attach'                 => '',
    'need_user_confirm'      => true,
    'openid'                 => '',
    'name'                   => '',
    'phone'                  => '',
    'userid'                 => '',
    'address'                => '',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/payscore/payafter-orders')->post([
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'out_order_no'           => '1234323JKHDFE1243252',
    'service_id'             => '500001',
    'service_start_time'     => '',
    'service_end_time'       => '',
    'service_start_location' => '',
    'service_end_location'   => '',
    'service_introduction'   => '',
    'fees'                   => [[
      'fee_name'   => '',
      'fee_count'  => 0,
      'fee_amount' => 0,
      'fee_desc'   => '',
    ],],
    'discounts'              => [[
      'discount_name' => '满20减1元',
      'discount_desc' => '不与其他优惠叠加',
    ],],
    'risk_amount'            => 0,
    'attach'                 => '',
    'need_user_confirm'      => true,
    'openid'                 => '',
    'name'                   => '',
    'phone'                  => '',
    'userid'                 => '',
    'address'                => '',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/payscore/payafter-orders']->post([
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'out_order_no'           => '1234323JKHDFE1243252',
    'service_id'             => '500001',
    'service_start_time'     => '',
    'service_end_time'       => '',
    'service_start_location' => '',
    'service_end_location'   => '',
    'service_introduction'   => '',
    'fees'                   => [[
      'fee_name'   => '',
      'fee_count'  => 0,
      'fee_amount' => 0,
      'fee_desc'   => '',
    ],],
    'discounts'              => [[
      'discount_name' => '满20减1元',
      'discount_desc' => '不与其他优惠叠加',
    ],],
    'risk_amount'            => 0,
    'attach'                 => '',
    'need_user_confirm'      => true,
    'openid'                 => '',
    'name'                   => '',
    'phone'                  => '',
    'userid'                 => '',
    'address'                => '',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
appidstring公众账号ID
mchidstring商户号
out_order_nostring商户服务订单号
service_idstring服务ID
order_idstring微信支付服务订单号
miniprogram_businesstypestring小程序跳转businessType
miniprogram_appidstring小程序跳转appid,在商户小程序跳转到微信侧小程序流程需要用到
miniprogram_pathstring小程序跳转路径
miniprogram_usernamestring小程序跳转username,在商户APP跳转微信侧小程序流程需要用到
packagestring用于跳转到微信侧小程序订单数据,跳转到微信侧小程序传入

参阅 官方文档

查询先享后付订单

请求参数类型描述
queryobject声明请求的查询参数
service_idstring服务ID
out_order_nostring商户服务订单号
query_idstring回跳查询ID
appidstring公众账号ID
php
$instance->v3->payscore->payafterOrders->getAsync([
  'query' => [
    'service_id'   => '',
    'out_order_no' => '',
    'query_id'     => '',
    'appid'        => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/payscore/payafter-orders')->getAsync([
  'query' => [
    'service_id'   => '',
    'out_order_no' => '',
    'query_id'     => '',
    'appid'        => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/payscore/payafter-orders']->getAsync([
  'query' => [
    'service_id'   => '',
    'out_order_no' => '',
    'query_id'     => '',
    'appid'        => '',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->payscore->payafterOrders->get([
  'query' => [
    'service_id'   => '',
    'out_order_no' => '',
    'query_id'     => '',
    'appid'        => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/payscore/payafter-orders')->get([
  'query' => [
    'service_id'   => '',
    'out_order_no' => '',
    'query_id'     => '',
    'appid'        => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/payscore/payafter-orders']->get([
  'query' => [
    'service_id'   => '',
    'out_order_no' => '',
    'query_id'     => '',
    'appid'        => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
appidstring公众账号ID
mchidstring商户号
out_order_nostring商户服务订单号
service_idstring服务ID
statestringCREATED | USER_ACCEPTED | FINISHED | USER_PAID | REVOKED | EXPIRED 枚举值之一
finish_typeinteger标识用户订单使用情况
1 | 2 枚举值之一
service_start_timestring服务开始时间
service_end_timestring服务结束时间
real_service_start_timestring实际服务开始时间
real_service_end_timestring实际服务结束时间
pay_succ_timestring支付完成时间
service_start_locationstring开始使用服务的地点
service_end_locationstring预计服务结束的地点
real_service_start_locationstring开始使用服务的地点
real_service_end_locationstring预计服务结束的地点
service_introductionstring服务信息,用于介绍本订单所提供的服务
feesobject[]后付费,描述付费项目列表
fee_namestring付费项目名称
fee_countinteger付费项目数量
fee_amountinteger付费项目总金额
fee_descstring描述计费规则
discountsobject[]商户优惠,最多包含5条商户优惠
discount_namestring优惠名称
discount_amountinteger商品优惠金额
discount_descstring优惠说明
risk_amountinteger订单风险金额
total_amountinteger总金额(大于等于0的数字,单位为分)
attachstring商户自定义说明,可存放本订单所需信息
finish_ticketstring用于完结订单时传入,确保订单完结时数据完整
finish_transaction_idstring结单交易单号
pay_typestring支付方式
MchChannelPayType 枚举值

参阅 官方文档

Published on the GitHub by TheNorthMemory