$mchid = ‘’; //商户id
$appid = ‘’; //appid
$apiKey = ‘’; //密钥
w x P a y = n e w W x p a y S e r v i c e C o n t r o l l e r ( wxPay = new WxpayServiceController( wxPay=newWxpayServiceController(mchid, a p p i d , appid, appid,apiKey);
$outTradeNo = uniqid(); //商品订单号
$payAmount = 0.1; //付款金额,单位:元
$orderName = ‘1’; //订单标题
$notifyUrl = ‘https://www.xxx.com/wx/’; //付款成功后的回调地址
$payTime = time(); //付款时间
$arr = w x P a y − > c r e a t e J s B i z P a c k a g e ( wxPay->createJsBizPackage( wxPay−>createJsBizPackage(payAmount, o u t T r a d e N o , outTradeNo, outTradeNo,orderName, n o t i f y U r l , notifyUrl, notifyUrl,payTime);
//生成二维码
u r l = ′ h t t p : / / q r . l i a n t u . c o m / a p i . p h p ? t e x t = ′ . url = 'http://qr.liantu.com/api.php?text='. url=′http://qr.liantu.com/api.php?text=′.arr[‘code_url’];
echo “”;
exit;//截止二维码图片
class WxpayServiceController
{
protected $mchid;
protected $appid;
protected $apiKey;
public function __construct($mchid, $appid, $key)
{
$this->mchid = $mchid;
$this->appid = $appid;
$this->apiKey = $key;
}