Skip to content

直连商户预扣费通知

如:若需要在3号扣费,则需要在1号将通知下发给用户,2号为用户的扣费等待期,用户可以选择等待扣费或关闭扣费服务,3号商户可正常发起扣费。

请求参数类型描述
contract_idstring委托代扣协议ID
jsonobject声明请求的JSON数据结构
mchidstring直连商户号
appidstring公众号ID
deduct_durationobject扣费持续时间
countinteger扣费持续时间数
1 | 2 | 3 枚举值之一
unitstring单位
DAY 枚举值
estimated_amountobject预计扣费金额信息
amountnumber预计扣费金额
currencystring预计扣费货币类型
php
$instance->v3->papay->contracts->_contract_id_->notify->postAsync([
  'contract_id' => '',
  'json' => [
    'mchid'            => '1230000109',
    '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/papay/contracts/{contract_id}/notify')->postAsync([
  'contract_id' => '',
  'json' => [
    'mchid'            => '1230000109',
    '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/papay/contracts/{contract_id}/notify']->postAsync([
  'contract_id' => '',
  'json' => [
    'mchid'            => '1230000109',
    '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->papay->contracts->_contract_id_->notify->post([
  'contract_id' => '',
  'json' => [
    'mchid'            => '1230000109',
    'appid'            => 'wxd678efh567hg6787',
    'deduct_duration'  => [
      'count' => 1,
      'unit'  => 'DAY',
    ],
    'estimated_amount' => [
      'amount'   => 1,
      'currency' => 'CNY',
    ],
  ],
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance->chain('v3/papay/contracts/{contract_id}/notify')->post([
  'contract_id' => '',
  'json' => [
    'mchid'            => '1230000109',
    'appid'            => 'wxd678efh567hg6787',
    'deduct_duration'  => [
      'count' => 1,
      'unit'  => 'DAY',
    ],
    'estimated_amount' => [
      'amount'   => 1,
      'currency' => 'CNY',
    ],
  ],
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance['v3/papay/contracts/{contract_id}/notify']->post([
  'contract_id' => '',
  'json' => [
    'mchid'            => '1230000109',
    '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