Skip to content

申请二级商户充值

商户系统须通过调用此接口获取充值链接,随后发起充值流程

请求参数类型描述
jsonobject声明请求的JSON数据结构
sub_mchidstring二级商户号
out_recharge_nostring商户充值单号
recharge_scenestring充值场景
ECOMMERCE_DEPOSIT | ECOMMERCE_BANK_TRANSFER | NORMAL_BANK_TRANSFER 枚举值之一
account_typestring充值入账账户
DEPOSIT | BASIC | OPERATION | FEES 枚举值之一
recharge_amountobject充值金额
amountnumber总金额
currencystring货币类型
notify_urlstring商户回调地址
php
$instance->v3->platsolution->ecommerce->recharges->apply->postAsync([
  'json' => [
    'sub_mchid'       => '1900001109',
    'out_recharge_no' => 'cz202407181234',
    'recharge_scene'  => 'ECOMMERCE_DEPOSIT',
    'account_type'    => 'DEPOSIT',
    'recharge_amount' => [
      'amount'   => 500000,
      'currency' => 'CNY',
    ],
    'notify_url'      => 'https://www.weixin.qq.com/wxpay/pay.php',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/platsolution/ecommerce/recharges/apply')->postAsync([
  'json' => [
    'sub_mchid'       => '1900001109',
    'out_recharge_no' => 'cz202407181234',
    'recharge_scene'  => 'ECOMMERCE_DEPOSIT',
    'account_type'    => 'DEPOSIT',
    'recharge_amount' => [
      'amount'   => 500000,
      'currency' => 'CNY',
    ],
    'notify_url'      => 'https://www.weixin.qq.com/wxpay/pay.php',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/platsolution/ecommerce/recharges/apply']->postAsync([
  'json' => [
    'sub_mchid'       => '1900001109',
    'out_recharge_no' => 'cz202407181234',
    'recharge_scene'  => 'ECOMMERCE_DEPOSIT',
    'account_type'    => 'DEPOSIT',
    'recharge_amount' => [
      'amount'   => 500000,
      'currency' => 'CNY',
    ],
    'notify_url'      => 'https://www.weixin.qq.com/wxpay/pay.php',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->platsolution->ecommerce->recharges->apply->post([
  'json' => [
    'sub_mchid'       => '1900001109',
    'out_recharge_no' => 'cz202407181234',
    'recharge_scene'  => 'ECOMMERCE_DEPOSIT',
    'account_type'    => 'DEPOSIT',
    'recharge_amount' => [
      'amount'   => 500000,
      'currency' => 'CNY',
    ],
    'notify_url'      => 'https://www.weixin.qq.com/wxpay/pay.php',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/platsolution/ecommerce/recharges/apply')->post([
  'json' => [
    'sub_mchid'       => '1900001109',
    'out_recharge_no' => 'cz202407181234',
    'recharge_scene'  => 'ECOMMERCE_DEPOSIT',
    'account_type'    => 'DEPOSIT',
    'recharge_amount' => [
      'amount'   => 500000,
      'currency' => 'CNY',
    ],
    'notify_url'      => 'https://www.weixin.qq.com/wxpay/pay.php',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/platsolution/ecommerce/recharges/apply']->post([
  'json' => [
    'sub_mchid'       => '1900001109',
    'out_recharge_no' => 'cz202407181234',
    'recharge_scene'  => 'ECOMMERCE_DEPOSIT',
    'account_type'    => 'DEPOSIT',
    'recharge_amount' => [
      'amount'   => 500000,
      'currency' => 'CNY',
    ],
    'notify_url'      => 'https://www.weixin.qq.com/wxpay/pay.php',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
recharge_idstring微信支付充值单号
out_recharge_nostring商户充值单号
recharge_urlstring充值链接

参阅 官方文档

Published on the GitHub by TheNorthMemory