Skip to content

发起公益捐赠

服务商商户可通过此接口发起公益捐赠 接口返回的HTTP状态码及错误码,仅代表本次请求的结果,不能代表订单状态。接口返回的HTTP状态码为200,且状态为ACCEPT时,可认为发起公益捐赠。接口返回的HTTP状态码不为200时,请商户务必不要立即更换商户订单单号重试。注:单个商户的接口频率限制为100次/s

请求参数类型描述
jsonobject声明请求的JSON数据结构
out_budget_nostring商户预算单号
out_transfer_nostring商户公益捐赠单号
transaction_infoobject关联的交易单号
transaction_typestring订单类型
WXPAY 枚举值
transaction_idstring订单号
sponsor_mchidstring出资商户号
receive_mchidstring收款商户号
amountnumber预算总金额
transfer_remarkstring捐赠备注
php
$instance->v3->fundApp->mchTransfer->partner->charityTransferBills->postAsync([
  'json' => [
    'out_budget_no'    => 'budget202506300102',
    'out_transfer_no'  => 'trans202506300102',
    'transaction_info' => [
      'transaction_type' => 'WXPAY',
      'transaction_id'   => '4217752501201407033233368018',
    ],
    'sponsor_mchid'    => '1900001109',
    'receive_mchid'    => '1900001109',
    'amount'           => 20000000,
    'transfer_remark'  => '帮助受助群体爱心捐款',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/fund-app/mch-transfer/partner/charity-transfer-bills')->postAsync([
  'json' => [
    'out_budget_no'    => 'budget202506300102',
    'out_transfer_no'  => 'trans202506300102',
    'transaction_info' => [
      'transaction_type' => 'WXPAY',
      'transaction_id'   => '4217752501201407033233368018',
    ],
    'sponsor_mchid'    => '1900001109',
    'receive_mchid'    => '1900001109',
    'amount'           => 20000000,
    'transfer_remark'  => '帮助受助群体爱心捐款',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/fund-app/mch-transfer/partner/charity-transfer-bills']->postAsync([
  'json' => [
    'out_budget_no'    => 'budget202506300102',
    'out_transfer_no'  => 'trans202506300102',
    'transaction_info' => [
      'transaction_type' => 'WXPAY',
      'transaction_id'   => '4217752501201407033233368018',
    ],
    'sponsor_mchid'    => '1900001109',
    'receive_mchid'    => '1900001109',
    'amount'           => 20000000,
    'transfer_remark'  => '帮助受助群体爱心捐款',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->fundApp->mchTransfer->partner->charityTransferBills->post([
  'json' => [
    'out_budget_no'    => 'budget202506300102',
    'out_transfer_no'  => 'trans202506300102',
    'transaction_info' => [
      'transaction_type' => 'WXPAY',
      'transaction_id'   => '4217752501201407033233368018',
    ],
    'sponsor_mchid'    => '1900001109',
    'receive_mchid'    => '1900001109',
    'amount'           => 20000000,
    'transfer_remark'  => '帮助受助群体爱心捐款',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/fund-app/mch-transfer/partner/charity-transfer-bills')->post([
  'json' => [
    'out_budget_no'    => 'budget202506300102',
    'out_transfer_no'  => 'trans202506300102',
    'transaction_info' => [
      'transaction_type' => 'WXPAY',
      'transaction_id'   => '4217752501201407033233368018',
    ],
    'sponsor_mchid'    => '1900001109',
    'receive_mchid'    => '1900001109',
    'amount'           => 20000000,
    'transfer_remark'  => '帮助受助群体爱心捐款',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/fund-app/mch-transfer/partner/charity-transfer-bills']->post([
  'json' => [
    'out_budget_no'    => 'budget202506300102',
    'out_transfer_no'  => 'trans202506300102',
    'transaction_info' => [
      'transaction_type' => 'WXPAY',
      'transaction_id'   => '4217752501201407033233368018',
    ],
    'sponsor_mchid'    => '1900001109',
    'receive_mchid'    => '1900001109',
    'amount'           => 20000000,
    'transfer_remark'  => '帮助受助群体爱心捐款',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
out_budget_nostring商户预算单号
budget_idstring微信支付预算单号
out_transfer_nostring商户公益捐赠单号
transfer_idstring微信支付公益捐赠单号
amountnumber预算总金额
transfer_remarkstring捐赠备注
receive_mchidstring收款商户号
statestring捐赠状态
ACCEPTED | SUCCESS | CLOSE 枚举值之一
create_timestring捐赠单创建时间
success_timestring捐赠完成时间

参阅 官方文档

Published on the GitHub by TheNorthMemory