This example for you to share the thinkphp integrated micro-credit payment code for your reference, the specific content as follows
Download: Payment SDK
To place the micro-credit payment SDK under the third party class library vendor, please remember to change the merchant information inside the WxPay.Config.php to your public number , so as to avoid the loss of funds.
PHP-Side code
Public function Pay () {
//merchant basic information, can be written dead inside WxPay.Config.php, other detailed reference wxpayconfig.php
vendor (' Pay.jsapi ');
$tools = new \jsapipay ();
$openid = $tools->getopenid ();
$Out _trade_no=date (' Yhis '). Rand (100,1000);
$Total _fee= ' test ';
$Body = ' Say nothing ';
$Total _fee=1;
$input = new \wxpayunifiedorder ();
$input->setbody ($Body);
$input->setout_trade_no ($Out _trade_no);
$input->settotal_fee ($Total _fee);
$input->setnotify_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-side code
It's as simple as that.
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.