Skip to content

代扣受理扣款

商户调用本接口发起委托代扣扣款。系统受理扣款请求后,异步进行扣款,并通过商户指定的回调地址通知扣费结果。本接口只返回受理结果,若受理成功,后续扣费结果将通过「委托代扣支付结果通知API」通知,商户也可调用「查询订单」接口获取订单状态。

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring应用ID
out_trade_nostring商户订单号
descriptionstring商品描述
transaction_notify_urlstring通知地址
contract_idstring委托代扣协议ID
amountobject扣费金额信息
totalnumber金额
currencystring货币类型
goods_tagstring订单优惠标记
attachstring附加数据
harmony_account_idstring鸿蒙账户id
mccstring商户类别码
php
$instance->v3->papay->pay->harmony->transactions->apply->postAsync([
  'json' => [
    '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'                 => '自定义数据',
    'harmony_account_id'     => 'example_harmony_account_id',
    'mcc'                    => '5734',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/papay/pay/harmony/transactions/apply')->postAsync([
  'json' => [
    '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'                 => '自定义数据',
    'harmony_account_id'     => 'example_harmony_account_id',
    'mcc'                    => '5734',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/papay/pay/harmony/transactions/apply']->postAsync([
  'json' => [
    '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'                 => '自定义数据',
    'harmony_account_id'     => 'example_harmony_account_id',
    'mcc'                    => '5734',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->papay->pay->harmony->transactions->apply->post([
  'json' => [
    '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'                 => '自定义数据',
    'harmony_account_id'     => 'example_harmony_account_id',
    'mcc'                    => '5734',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/papay/pay/harmony/transactions/apply')->post([
  'json' => [
    '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'                 => '自定义数据',
    'harmony_account_id'     => 'example_harmony_account_id',
    'mcc'                    => '5734',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/papay/pay/harmony/transactions/apply']->post([
  'json' => [
    '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'                 => '自定义数据',
    'harmony_account_id'     => 'example_harmony_account_id',
    'mcc'                    => '5734',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
out_trade_nostring商户订单号
amountobject扣费金额信息
totalnumber金额
currencystring货币类型

参阅 官方文档

Published on the GitHub by TheNorthMemory