trrtly/wechat

easywechat for hyperf

v0.0.6 2021-12-08 08:51 UTC

This package is auto-updated.

Last update: 2022-01-08 09:03:34 UTC


README

针对 hyperf 的 easywechat 组件.

安装

composer require trrtly/wechat

示例

use Trrtly\Wechat\Wechat;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Contract\ConfigInterface;

class Example
{
    public function transferToBalance(ConfigInterface $config)
    {
        $app = Wechat::payment($config->get('wechat.payment'));
        $response = $app->transfer->toBalance([
            'partner_trade_no' => '1233455', // 商户订单号,需保持唯一性(只能是字母或者数字,不能包含有符号)
            'openid' => 'oxTWIuGaIt6gTKsQRLau2M0yL16E',
            'check_name' => 'FORCE_CHECK', // NO_CHECK:不校验真实姓名, FORCE_CHECK:强校验真实姓名
            're_user_name' => '王小帅', // 如果 check_name 设置为FORCE_CHECK,则必填用户真实姓名
            'amount' => 10000, // 企业付款金额,单位为分
            'desc' => '理赔', // 企业付款操作说明信息。必填
        ]);
        var_dump($response);
    }
}