Skip to content

创建支付分计划

商户可以基于有按计划确认权限的服务,通过此接口创建支付分计划。

请求参数类型描述
jsonobject声明请求的JSON数据结构
service_idstring计划所属服务
appidstring服务商的AppID
sub_mchidstring子商户号
sub_appidstring子商户的AppID
plan_namestring支付分计划名称
plan_durationnumber支付分计划有效期(单位天)
deduction_quantitynumber支付分计划扣费次数
total_original_pricenumber支付分计划原总金额(单位分)
total_actual_pricenumber支付分计划实际扣费总金额(单位分)
plan_detail_listobject[]支付分计划明细列表
original_pricenumber计划明细原支付金额(单位分)
plan_discount_descriptionstring计划明细优惠说明
actual_pricenumber计划明细实际支付金额(单位分)
plan_detail_namestring计划明细名称
merchant_plan_nostring商户侧计划号
php
$instance->v3->payscore->plan->partner->payscorePlans->postAsync([
  'json' => [
    'service_id'           => '2002000000000558128851361561536',
    'appid'                => 'wxd678efh567hg6787',
    'sub_mchid'            => '1900000109',
    'sub_appid'            => 'wxd678efh567hg6787',
    'plan_name'            => '瑜伽课20节',
    'plan_duration'        => 300,
    'deduction_quantity'   => 10,
    'total_original_price' => 15000,
    'total_actual_price'   => 15000,
    'plan_detail_list'     => [[
      'original_price'            => 15000,
      'plan_discount_description' => '享受九折',
      'actual_price'              => 14000,
      'plan_detail_name'          => '第八节课',
    ],],
    'merchant_plan_no'     => '1234323JKHDFE1243252',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/payscore/plan/partner/payscore-plans')->postAsync([
  'json' => [
    'service_id'           => '2002000000000558128851361561536',
    'appid'                => 'wxd678efh567hg6787',
    'sub_mchid'            => '1900000109',
    'sub_appid'            => 'wxd678efh567hg6787',
    'plan_name'            => '瑜伽课20节',
    'plan_duration'        => 300,
    'deduction_quantity'   => 10,
    'total_original_price' => 15000,
    'total_actual_price'   => 15000,
    'plan_detail_list'     => [[
      'original_price'            => 15000,
      'plan_discount_description' => '享受九折',
      'actual_price'              => 14000,
      'plan_detail_name'          => '第八节课',
    ],],
    'merchant_plan_no'     => '1234323JKHDFE1243252',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/payscore/plan/partner/payscore-plans']->postAsync([
  'json' => [
    'service_id'           => '2002000000000558128851361561536',
    'appid'                => 'wxd678efh567hg6787',
    'sub_mchid'            => '1900000109',
    'sub_appid'            => 'wxd678efh567hg6787',
    'plan_name'            => '瑜伽课20节',
    'plan_duration'        => 300,
    'deduction_quantity'   => 10,
    'total_original_price' => 15000,
    'total_actual_price'   => 15000,
    'plan_detail_list'     => [[
      'original_price'            => 15000,
      'plan_discount_description' => '享受九折',
      'actual_price'              => 14000,
      'plan_detail_name'          => '第八节课',
    ],],
    'merchant_plan_no'     => '1234323JKHDFE1243252',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->payscore->plan->partner->payscorePlans->post([
  'json' => [
    'service_id'           => '2002000000000558128851361561536',
    'appid'                => 'wxd678efh567hg6787',
    'sub_mchid'            => '1900000109',
    'sub_appid'            => 'wxd678efh567hg6787',
    'plan_name'            => '瑜伽课20节',
    'plan_duration'        => 300,
    'deduction_quantity'   => 10,
    'total_original_price' => 15000,
    'total_actual_price'   => 15000,
    'plan_detail_list'     => [[
      'original_price'            => 15000,
      'plan_discount_description' => '享受九折',
      'actual_price'              => 14000,
      'plan_detail_name'          => '第八节课',
    ],],
    'merchant_plan_no'     => '1234323JKHDFE1243252',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/payscore/plan/partner/payscore-plans')->post([
  'json' => [
    'service_id'           => '2002000000000558128851361561536',
    'appid'                => 'wxd678efh567hg6787',
    'sub_mchid'            => '1900000109',
    'sub_appid'            => 'wxd678efh567hg6787',
    'plan_name'            => '瑜伽课20节',
    'plan_duration'        => 300,
    'deduction_quantity'   => 10,
    'total_original_price' => 15000,
    'total_actual_price'   => 15000,
    'plan_detail_list'     => [[
      'original_price'            => 15000,
      'plan_discount_description' => '享受九折',
      'actual_price'              => 14000,
      'plan_detail_name'          => '第八节课',
    ],],
    'merchant_plan_no'     => '1234323JKHDFE1243252',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/payscore/plan/partner/payscore-plans']->post([
  'json' => [
    'service_id'           => '2002000000000558128851361561536',
    'appid'                => 'wxd678efh567hg6787',
    'sub_mchid'            => '1900000109',
    'sub_appid'            => 'wxd678efh567hg6787',
    'plan_name'            => '瑜伽课20节',
    'plan_duration'        => 300,
    'deduction_quantity'   => 10,
    'total_original_price' => 15000,
    'total_actual_price'   => 15000,
    'plan_detail_list'     => [[
      'original_price'            => 15000,
      'plan_discount_description' => '享受九折',
      'actual_price'              => 14000,
      'plan_detail_name'          => '第八节课',
    ],],
    'merchant_plan_no'     => '1234323JKHDFE1243252',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
plan_idstring支付分计划ID
service_idstring计划所属服务
mchidstring服务商商户号
sub_mchidstring子商户商户号
appidstring服务商AppID
sub_appidstring子商户AppID
merchant_plan_nostring商户侧计划号
plan_namestring支付分计划名称
plan_durationnumber支付分计划有效期(单位天)
plan_statestring支付分计划状态
total_original_pricenumber支付分计划原总金额(单位分)
deduction_quantitynumber支付分计划扣费次数
total_actual_pricenumber支付分计划实际扣费总金额(单位分)
plan_detail_listobject[]支付分计划明细列表
plan_detail_nonumber计划明细序号
plan_detail_namestring计划明细名称
original_pricenumber计划明细原支付金额(单位分)
plan_discount_descriptionstring计划明细优惠说明
actual_pricenumber计划明细实际支付金额(单位分)
stop_mchidstring终止方商户号
stop_timestring终止时间

参阅 官方文档

Published on the GitHub by TheNorthMemory