thinkphp 微信商家转账功能(小程序)

首选需要给微信商户的运营账户充钱,保证账户有钱

首选需要给微信商户的运营账户充钱,保证账户有钱

首选需要给微信商户的运营账户充钱,保证账户有钱

    protected $mch_id = '16xxx'; //商户号
    protected $appid = 'wxxxx'; //商户号Appid
    protected $cert_pem =  '/www/wwwroot/xxxx/public/cert/apiclient_cert_10002.pem'; //V3 商户证书在服务器位置
    protected $key_pem = '/www/wwwroot/xxxx/public/cert/apiclient_key_10002.pem';
	//调用这个方法
	//$money 金额
	//$out_bill_no 订单号
	public function payOrder($money,$out_bill_no){
		$userInfo=self::userInfo();
		$appInfo=self::appInfo();
        //按转账场景发起转账
        //文档https://pay.weixin.qq.com/doc/v3/merchant/4012711988
        $params = [
            "appid" => $this->appid,
            "out_bill_no" => $out_bill_no,
            "transfer_scene_id" => "1005", 
            "openid" => $userInfo['openid'],
            "transfer_amount" => $money*100,
            "transfer_remark" => "佣金报酬",
            "notify_url" => "https://xxxxx/api/user.withdraw/update_do",
            "user_recv_perception" => "劳务报酬",
            "transfer_scene_report_infos" => [
                [
                    "info_type" => "岗位类型",
                    "info_content" => "外

你可能感兴趣的:(微信,小程序)