Skip to content

受理扣款

商户调用「预约扣费」接口预约成功后,可调用本接口发起委托代扣扣款。系统受理扣款请求后,异步进行扣款,并通过商户指定的回调地址通知扣费结果。

请求参数类型描述
jsonobject声明请求的JSON数据结构
sp_appidstring应用ID
sub_mchidstring子商户号商户号
sub_appidstring子商户的AppID
out_trade_nostring商户订单号
descriptionstring商品描述
transaction_notify_urlstring通知地址
contract_idstring委托代扣协议ID
amountobject扣费金额信息
totalnumber金额
currencystring货币类型
goods_tagstring订单优惠标记
attachstring附加数据
php
$instance->v3->papay->pay->partner->transactions->apply->postAsync([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'out_trade_no' => '1217752501201407033233368018',
    'description' => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url' => 'https://www.qq.com/',
    'contract_id' => '123124412412423431',
    'amount' => [
      'total' => 1,
      'currency' => 'CNY',
    ],
    'goods_tag' => 'DISCOUNTS',
    'attach' => '自定义数据',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/papay/pay/partner/transactions/apply')->postAsync([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'out_trade_no' => '1217752501201407033233368018',
    'description' => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url' => 'https://www.qq.com/',
    'contract_id' => '123124412412423431',
    'amount' => [
      'total' => 1,
      'currency' => 'CNY',
    ],
    'goods_tag' => 'DISCOUNTS',
    'attach' => '自定义数据',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/papay/pay/partner/transactions/apply']->postAsync([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'out_trade_no' => '1217752501201407033233368018',
    'description' => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url' => 'https://www.qq.com/',
    'contract_id' => '123124412412423431',
    'amount' => [
      'total' => 1,
      'currency' => 'CNY',
    ],
    'goods_tag' => 'DISCOUNTS',
    'attach' => '自定义数据',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->papay->pay->partner->transactions->apply->post([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'out_trade_no' => '1217752501201407033233368018',
    'description' => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url' => 'https://www.qq.com/',
    'contract_id' => '123124412412423431',
    'amount' => [
      'total' => 1,
      'currency' => 'CNY',
    ],
    'goods_tag' => 'DISCOUNTS',
    'attach' => '自定义数据',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/papay/pay/partner/transactions/apply')->post([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'out_trade_no' => '1217752501201407033233368018',
    'description' => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url' => 'https://www.qq.com/',
    'contract_id' => '123124412412423431',
    'amount' => [
      'total' => 1,
      'currency' => 'CNY',
    ],
    'goods_tag' => 'DISCOUNTS',
    'attach' => '自定义数据',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/papay/pay/partner/transactions/apply']->post([
  'json' => [
    'sp_appid' => 'wxd678efh567hg6787',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wxd678efh567hg6787',
    'out_trade_no' => '1217752501201407033233368018',
    'description' => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url' => 'https://www.qq.com/',
    'contract_id' => '123124412412423431',
    'amount' => [
      'total' => 1,
      'currency' => 'CNY',
    ],
    'goods_tag' => 'DISCOUNTS',
    'attach' => '自定义数据',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
out_trade_nostring商户订单号
amountobject扣费金额信息
totalnumber金额
currencystring货币类型

参阅 官方文档

Published on the GitHub by TheNorthMemory