composer require zhangv/wechat-pay
* 获取公众号支付参数(公众号网页支付)
```php
$wp = WechatPay::Jsapi($cfg);
$prepayId = $wp->getPrepayId($body, $orderNo, $amt, $openid);
$package = $wp->getPackage($prepayId);
* 获取APP的支付参数(APP支付)
```php
$wp = WechatPay::App($cfg);
$prepayId = $wp->getPrepayId($body, $orderNo, $amt, $openid);
$package = $wp->getPackage($prepayId);
* 获取扫码支付URL(扫码支付)
```php
$wp = WechatPay::Native($cfg);
$url = $wp->getCodeUrl($body,$out_trade_no,$total_fee,$product_id);
* 支付结果后台通知处理
```php
$notifyxml = file_get_contents("php://input");
$wp = new WechatPay($cfg);
$msg = $wp->onPaidNotify($notifyxml, function($notifyArray){
//处理逻辑
return 'ok';
});
$xml = "<xml>
<return_code>SUCCESS</return_code>
<return_msg><![CDATA[$msg]]></return_msg>
</xml>";
echo $xml;
* 企业付款
```php
$wp = WechatPay::Mchpay($cfg);
//付款到零钱
$result = $wp->transferWallet($partner_trade_no,$openid,$amount,$desc);
//付款到银行卡
$result = $wp->transferBankCard($partner_trade_no,$bank_no,$true_name,$bank_code,$amount,$desc);
* 代金券
```php
$wp = WechatPay::Coupon($cfg);
//发放代金券
$result = $wp->sendCoupon($coupon_stock_id,$open_id,$partner_trade_no);
//查询代金券批次
$result = $wp->queryCouponStock($coupon_stock_id);