PHP Development Micro-credit payment code sharing _php instance

Source: Internet
Author: User

Micro-credit payment, even if the deposit, you still deal with the test phase, can not be officially released. You must submit your orders, delivery notices and other data to the micro-credit system through the program test before you can apply for publication.

Then, because in the micro-letter is to invoke the API in a JS way, you must set up the payment authorization directory in the micro-letter background, and to go to level two three directory, which is a small problem with the MVC framework.

Using MVC, in the development environment, URLs are often native URL formats and cannot be guaranteed to be in the form of a path/

Therefore, a more reliable way is to create subfolders of the entity, such as the system as a whole URL, need to do some transformation.

In addition, the last step, JS call, for HTTPS://GITHUB.COM/DODGEPUDDING/WECHAT-PHP-SDK here to provide the JS library, in the call, you must ensure that the page is loaded after the trigger, That is, the state of the weixinjsbridgeready, because it can be communicated with the micro-trust browser with Jsbridge.

5.24 Repair

You can see the relevant code in the micro-engine.

Copy Code code as follows:

<script type= "Text/javascript" >
Document.addeventlistener (' Weixinjsbridgeready ', function Onbridgeready () {
Weixinjsbridge.invoke (' Getbrandwcpayrequest ', {
' AppId ': ' <?php echo $wOpt [' appId '];? > ',
' TimeStamp ': ' <?php echo $wOpt [' TimeStamp '];? > ',
' Noncestr ': ' <?php echo $wOpt [' noncestr '];? > ',
' Package ': ' <?php echo $wOpt [' package '];? > ',
' Signtype ': ' <?php echo $wOpt [' Signtype '];? > ',
' Paysign ': ' <?php echo $wOpt [' paysign '];? > '
}, function (res) {
if (res.err_msg = = ' Get_brand_wcpay_request:ok ') {
} else {
Alert (' Start a micro-letter payment failure, please check your payment parameters.) The detailed error is: ' + res.err_msg ';
}
History.go (-1);
});
}, False);
</script>

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.