Direct vender WeChat official payment V3 package

Source: Internet
Author: User
Tags openid
Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn and directly place them in the official payment V3 package of vender, just with simple path correction, keep the official source files downloaded directly
Call example // + ----------------------------------------------------------------------
// | Author: left side (add group: 366504956 (just created, welcome) for thinkphp Development)
// + ----------------------------------------------------------------------


Public function Index (){
// Basic merchant information, which can be written to WxPay. Config. php. For more information, see WxPayConfig. php.
Define ('appid ', 'wx9dc408cb04cd6d2d ');
Define ('mchid', '123 ');
Define ('key', 'e10adc3949ba59abbe56e757f20f883e ');
Define ('appsecret', '8c97c84a34f4be1d46bd35b7e51df86a ');

Vendor ('pay. JSAPI ');
$ Tools = new \ JsApiPay ();
$ OpenId = 'oql2zwuwtvqsd73jtzuzrc2kfyea ';
$ Out_trade_no = date ('yhis '). rand );
$ Total_tests = 'test ';
$ Body = 'nothing to say ';
$ Total_timeout = 1;
$ Input = new \ WxPayUnifiedOrder ();
$ Input-> SetBody ($ Body );
$ Input-> SetOut_trade_no ($ Out_trade_no );
$ Input-> SetTotal_fee ($ Total_fee );
$ Input-> setpolicy_url ("http://xx.xxx.com/pay/notify.php ");
$ Input-> SetTrade_type ("JSAPI ");
$ Input-> SetOpenid ($ openId );
$ Order = \ WxPayApi: unifiedOrder ($ input );
$ This-> jsApiParameters = $ tools-> GetJsApiParameters ($ order );
$ This-> display ();
}
Html


Secure Payment










Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.