Skip to content

服务商商户预扣费通知

商户进行委托代扣扣费前需要在可通知时间段内调用「预扣费通知」的接口为用户发送扣费提醒,并设定预计扣费金额,经过扣费等待期后,在可扣费期内可发起扣费,扣款金额不能高于预计扣费金额,扣费失败可主动发起重试扣费(重试次数由其他规则限制),直到扣费成功,或者可扣费期结束。

请求参数类型描述
contract_idstring委托代扣协议id
jsonobject声明请求的JSON数据结构
sp_mchidstring服务商商户号
sp_appidstring服务商应用ID
sub_mchidstring子商户号
sub_appidstring子商户应用D
deduct_durationobject扣费持续时间
countnumber扣费持续时间数
unitstring单位
estimated_amountobject预计扣费金额信息
amountnumber预计扣费金额
currencystring预计扣费货币类型
php
$instance->v3->partnerPapay->contracts->_contract_id_->notify->postAsync([
  'contract_id' => '123124412412423431',
  'json' => [
    'sp_mchid'         => '1230000109',
    'sp_appid'         => 'wxd678efh567hg6787',
    'sub_mchid'        => '12345512',
    'sub_appid'        => 'wxd678efh567hg6787',
    'deduct_duration'  => [
      'count' => 1,
      'unit'  => 'DAY',
    ],
    'estimated_amount' => [
      'amount'   => 1,
      'currency' => 'CNY',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r($response->getStatusCode() === 204);
})
->wait();
php
$instance->chain('v3/partner-papay/contracts/{contract_id}/notify')->postAsync([
  'contract_id' => '123124412412423431',
  'json' => [
    'sp_mchid'         => '1230000109',
    'sp_appid'         => 'wxd678efh567hg6787',
    'sub_mchid'        => '12345512',
    'sub_appid'        => 'wxd678efh567hg6787',
    'deduct_duration'  => [
      'count' => 1,
      'unit'  => 'DAY',
    ],
    'estimated_amount' => [
      'amount'   => 1,
      'currency' => 'CNY',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r($response->getStatusCode() === 204);
})
->wait();
php
$instance['v3/partner-papay/contracts/{contract_id}/notify']->postAsync([
  'contract_id' => '123124412412423431',
  'json' => [
    'sp_mchid'         => '1230000109',
    'sp_appid'         => 'wxd678efh567hg6787',
    'sub_mchid'        => '12345512',
    'sub_appid'        => 'wxd678efh567hg6787',
    'deduct_duration'  => [
      'count' => 1,
      'unit'  => 'DAY',
    ],
    'estimated_amount' => [
      'amount'   => 1,
      'currency' => 'CNY',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r($response->getStatusCode() === 204);
})
->wait();
php
$response = $instance->v3->partnerPapay->contracts->_contract_id_->notify->post([
  'contract_id' => '123124412412423431',
  'json' => [
    'sp_mchid'         => '1230000109',
    'sp_appid'         => 'wxd678efh567hg6787',
    'sub_mchid'        => '12345512',
    'sub_appid'        => 'wxd678efh567hg6787',
    'deduct_duration'  => [
      'count' => 1,
      'unit'  => 'DAY',
    ],
    'estimated_amount' => [
      'amount'   => 1,
      'currency' => 'CNY',
    ],
  ],
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance->chain('v3/partner-papay/contracts/{contract_id}/notify')->post([
  'contract_id' => '123124412412423431',
  'json' => [
    'sp_mchid'         => '1230000109',
    'sp_appid'         => 'wxd678efh567hg6787',
    'sub_mchid'        => '12345512',
    'sub_appid'        => 'wxd678efh567hg6787',
    'deduct_duration'  => [
      'count' => 1,
      'unit'  => 'DAY',
    ],
    'estimated_amount' => [
      'amount'   => 1,
      'currency' => 'CNY',
    ],
  ],
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance['v3/partner-papay/contracts/{contract_id}/notify']->post([
  'contract_id' => '123124412412423431',
  'json' => [
    'sp_mchid'         => '1230000109',
    'sp_appid'         => 'wxd678efh567hg6787',
    'sub_mchid'        => '12345512',
    'sub_appid'        => 'wxd678efh567hg6787',
    'deduct_duration'  => [
      'count' => 1,
      'unit'  => 'DAY',
    ],
    'estimated_amount' => [
      'amount'   => 1,
      'currency' => 'CNY',
    ],
  ],
]);
print_r($response->getStatusCode() === 204);
返回字典类型描述
空字符串(无返回内容)

参阅 官方文档

Published on the GitHub by TheNorthMemory