Skip to content

完结支付分订单

完结微信支付分订单。用户使用服务完成后,商户可通过此接口完结订单。**前置条件:** 服务订单状态为“进行中”且订单状态说明需为

请求参数类型描述
out_order_nostring商户服务订单号
jsonobject声明请求的JSON数据结构
appidstring公众账号ID
service_idstring服务订单号
post_paymentsobject[]后付费项目
namestring付费名称
amountnumber付费金额
descriptionstring付费说明
countnumber付费数量
post_discountsobject[]商户优惠
namestring优惠名称
descriptionstring优惠说明
amountnumber优惠金额
countnumber优惠数量
total_amountnumber总金额
time_rangeobject实际服务时间段
start_timestring服务开始时间
end_timestring服务结束时间
start_time_remarkstring服务开始时间备注
end_time_remarkstring服务结束时间备注
locationobject实际服务位置
end_locationstring服务结束地点
profit_sharingboolean微信支付服务分账标记
goods_tagstring订单优惠标记
deviceobject设备信息
start_device_idstring服务开始的设备ID
end_device_idstring服务结束的设备ID
materiel_nostring物料编码
php
$instance->v3->payscore->serviceorder->_out_order_no_->complete->postAsync([
  'out_order_no' => '',
  'json' => [
    'appid'          => 'wxd678efh567hg6787',
    'service_id'     => '2002000000000558128851361561536',
    'post_payments'  => [[
      'name'        => '就餐费用',
      'amount'      => 40000,
      'description' => '就餐人均100元',
      'count'       => 4,
    ],],
    'post_discounts' => [[
      'name'        => '满20减1元',
      'description' => '不与其他优惠叠加',
      'amount'      => 100,
      'count'       => 2,
    ],],
    'total_amount'   => 50000,
    'time_range'     => [
      'start_time'        => '20091225091010',
      'end_time'          => '20091225121010',
      'start_time_remark' => '备注1',
      'end_time_remark'   => '备注2',
    ],
    'location'       => [
      'end_location' => '嗨客时尚主题展餐厅',
    ],
    'profit_sharing' => true,
    'goods_tag'      => 'goods_tag',
    'device'         => [
      'start_device_id' => 'HG123456',
      'end_device_id'   => 'HG123456',
      'materiel_no'     => 'example_materiel_no',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/payscore/serviceorder/{out_order_no}/complete')->postAsync([
  'out_order_no' => '',
  'json' => [
    'appid'          => 'wxd678efh567hg6787',
    'service_id'     => '2002000000000558128851361561536',
    'post_payments'  => [[
      'name'        => '就餐费用',
      'amount'      => 40000,
      'description' => '就餐人均100元',
      'count'       => 4,
    ],],
    'post_discounts' => [[
      'name'        => '满20减1元',
      'description' => '不与其他优惠叠加',
      'amount'      => 100,
      'count'       => 2,
    ],],
    'total_amount'   => 50000,
    'time_range'     => [
      'start_time'        => '20091225091010',
      'end_time'          => '20091225121010',
      'start_time_remark' => '备注1',
      'end_time_remark'   => '备注2',
    ],
    'location'       => [
      'end_location' => '嗨客时尚主题展餐厅',
    ],
    'profit_sharing' => true,
    'goods_tag'      => 'goods_tag',
    'device'         => [
      'start_device_id' => 'HG123456',
      'end_device_id'   => 'HG123456',
      'materiel_no'     => 'example_materiel_no',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/payscore/serviceorder/{out_order_no}/complete']->postAsync([
  'out_order_no' => '',
  'json' => [
    'appid'          => 'wxd678efh567hg6787',
    'service_id'     => '2002000000000558128851361561536',
    'post_payments'  => [[
      'name'        => '就餐费用',
      'amount'      => 40000,
      'description' => '就餐人均100元',
      'count'       => 4,
    ],],
    'post_discounts' => [[
      'name'        => '满20减1元',
      'description' => '不与其他优惠叠加',
      'amount'      => 100,
      'count'       => 2,
    ],],
    'total_amount'   => 50000,
    'time_range'     => [
      'start_time'        => '20091225091010',
      'end_time'          => '20091225121010',
      'start_time_remark' => '备注1',
      'end_time_remark'   => '备注2',
    ],
    'location'       => [
      'end_location' => '嗨客时尚主题展餐厅',
    ],
    'profit_sharing' => true,
    'goods_tag'      => 'goods_tag',
    'device'         => [
      'start_device_id' => 'HG123456',
      'end_device_id'   => 'HG123456',
      'materiel_no'     => 'example_materiel_no',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->payscore->serviceorder->_out_order_no_->complete->post([
  'out_order_no' => '',
  'json' => [
    'appid'          => 'wxd678efh567hg6787',
    'service_id'     => '2002000000000558128851361561536',
    'post_payments'  => [[
      'name'        => '就餐费用',
      'amount'      => 40000,
      'description' => '就餐人均100元',
      'count'       => 4,
    ],],
    'post_discounts' => [[
      'name'        => '满20减1元',
      'description' => '不与其他优惠叠加',
      'amount'      => 100,
      'count'       => 2,
    ],],
    'total_amount'   => 50000,
    'time_range'     => [
      'start_time'        => '20091225091010',
      'end_time'          => '20091225121010',
      'start_time_remark' => '备注1',
      'end_time_remark'   => '备注2',
    ],
    'location'       => [
      'end_location' => '嗨客时尚主题展餐厅',
    ],
    'profit_sharing' => true,
    'goods_tag'      => 'goods_tag',
    'device'         => [
      'start_device_id' => 'HG123456',
      'end_device_id'   => 'HG123456',
      'materiel_no'     => 'example_materiel_no',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/payscore/serviceorder/{out_order_no}/complete')->post([
  'out_order_no' => '',
  'json' => [
    'appid'          => 'wxd678efh567hg6787',
    'service_id'     => '2002000000000558128851361561536',
    'post_payments'  => [[
      'name'        => '就餐费用',
      'amount'      => 40000,
      'description' => '就餐人均100元',
      'count'       => 4,
    ],],
    'post_discounts' => [[
      'name'        => '满20减1元',
      'description' => '不与其他优惠叠加',
      'amount'      => 100,
      'count'       => 2,
    ],],
    'total_amount'   => 50000,
    'time_range'     => [
      'start_time'        => '20091225091010',
      'end_time'          => '20091225121010',
      'start_time_remark' => '备注1',
      'end_time_remark'   => '备注2',
    ],
    'location'       => [
      'end_location' => '嗨客时尚主题展餐厅',
    ],
    'profit_sharing' => true,
    'goods_tag'      => 'goods_tag',
    'device'         => [
      'start_device_id' => 'HG123456',
      'end_device_id'   => 'HG123456',
      'materiel_no'     => 'example_materiel_no',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/payscore/serviceorder/{out_order_no}/complete']->post([
  'out_order_no' => '',
  'json' => [
    'appid'          => 'wxd678efh567hg6787',
    'service_id'     => '2002000000000558128851361561536',
    'post_payments'  => [[
      'name'        => '就餐费用',
      'amount'      => 40000,
      'description' => '就餐人均100元',
      'count'       => 4,
    ],],
    'post_discounts' => [[
      'name'        => '满20减1元',
      'description' => '不与其他优惠叠加',
      'amount'      => 100,
      'count'       => 2,
    ],],
    'total_amount'   => 50000,
    'time_range'     => [
      'start_time'        => '20091225091010',
      'end_time'          => '20091225121010',
      'start_time_remark' => '备注1',
      'end_time_remark'   => '备注2',
    ],
    'location'       => [
      'end_location' => '嗨客时尚主题展餐厅',
    ],
    'profit_sharing' => true,
    'goods_tag'      => 'goods_tag',
    'device'         => [
      'start_device_id' => 'HG123456',
      'end_device_id'   => 'HG123456',
      'materiel_no'     => 'example_materiel_no',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));

后付费项目(post_payments) 商户需要按照所属行业规程,有如下固定传参要求:

php
'post_payments' => [
  [
    'name'        => '收费标准',  // 固定值
    'description' => '1元/1小时', // 示例值
  ],
  [
    'name'        => '使用时长',      // 固定值
    'description' => '1小时38分20秒', // 示例值
  ],
],
php
'post_payments' => [
  [
    'name'        => '收费标准',                   // 固定值
    'description' => '3元/60分钟,每24小时封顶30元', // 示例值
  ],
  [
    'name'        => '使用时长',      // 固定值
    'description' => '1小时38分20秒', // 示例值
  ],
],
php
'post_payments' => [
  [
    'name'        => '计费规则',            // 固定值
    'description' => '骑行费用1.5元/30分钟', // 示例值
  ],
  [
    'name'        => '骑行时长',      // 固定值
    'description' => '1小时38分20秒', // 示例值
  ],
  [ // 选填组
    'name'   => '骑行费用', // 固定值
    'amount' => 1200,      // 示例值
  ],
  [ // 选填组
    'name'   => '调度费用', // 固定值
    'amount' => 1200,      // 示例值
  ],
  [ // 选填组
    'name'   => '头盔费用', // 固定值
    'amount' => 1200,      // 示例值
  ],
  [ // 选填组
    'name'   => '罚款', // 固定值
    'amount' => 1200,  // 示例值
  ],
],
php
'post_payments' => [
  [
    'name'   => '首重费', // 固定值
    'amount' => 1200,    // 示例值
  ],
  [ // 选填组
    'name'   => '续重费', // 固定值
    'amount' => 1200,    // 示例值
  ],
  [ // 选填组
    'name'   => '包装费', // 固定值
    'amount' => 1200,    // 示例值
  ],
  [ // 选填组
    'name'   => '保价费', // 固定值
    'amount' => 1200,    // 示例值
  ],
],
php
'post_payments' => [
  [
    'name'        => '商品信息', // 固定值
    'amount'      => 300,      // 示例值
    'description' => '可乐',   // 示例值
    'count'       => 1,       // 示例值
  ],
  [ // 最多选填99组
    'name'        => '商品信息', // 固定值
    'amount'      => 300,      // 示例值
    'description' => '雪碧',   // 示例值
    'count'       => 1,       // 示例值
  ],
],
php
'post_payments' => [
  [
    'name'        => '计费规则',                   // 固定值
    'description' => '电费0.1元/度,服务费0.1元/度', // 示例值
  ],
  [
    'name'        => '费用明细',              // 固定值
    'description' => '电费0.2元,服务费0.2元', // 示例值
  ],
],
php
'post_payments' => [ // 订单无收款费用(0元完结订单)
  [
    'name'        => '租车相关费用', // 固定值
    'description' => '本次无扣款',   // 固定值
  ],
],
'post_payments' => [ // 订单有收款费用(非0元完结),至少有其中一组
  [ // 选填组
    'name'        => '延迟还车费用',  // 固定值
    'amount'      => 1000,          // 示例值
    'description' => '延迟还车2小时', // 示例值
    'count'       => 1,             // 示例值
  ],
  [ // 选填组
    'name'        => '加油费用',  // 固定值
    'amount'      => 9999,       // 示例值
    'description' => '97#5升',   // 示例值
    'count'       => 1,         // 示例值
  ],
  [ // 选填组
    'name'        => 'ETC高速费用',                        // 固定值
    'amount'      => 2000,                                // 示例值
    'description' => '2024年9月1日在深圳高速出口产生高速费用', // 示例值
    'count'       => 1,                                   // 示例值
  ],
  [ // 选填组
    'name'        => '车损费用',                                   // 固定值
    'amount'      => 8888,                                       // 示例值
    'description' => '客户租用期间车辆右后门发生单方剐擦,需要扣款维修', // 示例值
    'count'       => 1,                                         // 示例值
  ],
  [ // 选填组
    'name'        => '折旧费用',       // 固定值
    'amount'      => 6666,            // 示例值
    'description' => '租用十三个月折旧', // 示例值
    'count'       => 1,               // 示例值
  ],
  [ // 选填组
    'name'        => '停运费用',            // 固定值
    'amount'      => 7777,                 // 示例值
    'description' => '车损需返厂维修一个月',  // 示例值
    'count'       => 1,                   // 示例值
  ],
  [ // 选填组
    'name'        => '闯红灯违章',                     // 固定值
    'amount'      => 5555,                           // 示例值
    'description' => '2024年9月1日在深圳高速出口闯红灯',  // 示例值
    'count'       => 1,                              // 示例值
  ],
],
php
'post_payments' => [
  [
    'name'        => '酒店房费',             // 固定值
    'amount'      => 1200,                 // 示例值
    'description' => '北京中关村某酒店标准间', // 示例值
  ],
  [ // 选填组
    'name'        => '其他杂费',   // 固定值
    'amount'      => 200,        // 示例值
    'description' => '房间清洁费', // 示例值
  ],
],
返回字典类型描述
appidstring公众账号ID
mchidstring商户号
out_order_nostring商户服务订单号
service_idstring服务ID
service_introductionstring服务信息
statestring服务订单状态
CREATED | DOING | DONE | REVOKED | EXPIRED 枚举值之一
state_descriptionstring订单状态说明
USER_CONFIRM | MCH_COMPLETE 枚举值之一
total_amountnumber商户收款总金额
post_paymentsobject[]后付费项目
namestring付费名称
amountnumber付费金额
descriptionstring付费说明
countnumber付费数量
post_discountsobject[]后付费商户优惠
namestring优惠名称
descriptionstring优惠说明
amountnumber优惠金额
countnumber优惠数量
risk_fundobject服务风险金
namestring风险名称
DEPOSIT | ADVANCE | CASH_DEPOSIT | ESTIMATE_ORDER_COST 枚举值之一
amountnumber风险金额
descriptionstring风险说明
time_rangeobject服务时间段
start_timestring服务开始时间
end_timestring服务结束时间
start_time_remarkstring服务开始时间备注
end_time_remarkstring服务结束时间备注
locationobject服务位置
end_locationstring服务结束地点
order_idstring微信支付服务订单号
need_collectionboolean是否需要收款

参阅 [USER_CONFIRM:用户确认] 官方文档 官方文档 官方文档 官方文档

Published on the GitHub by TheNorthMemory