PHP code example of vvv / weixin-pay

1. Go to this page and download the library: Download vvv/weixin-pay 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/ */

    

vvv / weixin-pay example snippets


  $wexin = new  WxPay($appid, $mch_id, $api_key);
   $params = [
              'total_fee' => 1, //单位分
              'out_trade_no' =>  time(),
              'body' => 'subject-测试',
              'notify_url' => '回调地址',
          ];
  return   $wexin->wxpayandroid($params);
  
  //异步回调
  
    return   $wexin->notify();