PHP code example of oywenjiao / wxtool

1. Go to this page and download the library: Download oywenjiao/wxtool library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oywenjiao / wxtool example snippets


// 实例化公共类
$base = new WxBase($appId, $appSecret);

// 调用统一下单接口
$wx_order = new Order($base);
$wx_order->setMchID($mchId)->setKey($key);
$res = $wx_order->unifiedOrder($openid, $trade_sn, $price, $notify, $body);

// 调用企业付款 
$wx_order = new Order($base);
$wx_order->setMchID($obj->mchId)->setKey($obj->key)->setCert($cert)->setSslKey($key);
$res = $wx_order->payToUser($openid, $trade_sn, $price, $desc);