WeChat scan code payment on PC side and Alipay online payment

When the blogger wrote this shit, it took almost two days to understand the logic as a whole. After thinking about it~ I should release all the code for everyone~ With the spirit of open source and selfless! Who told me to be good at making porn? At the same time, I also thank the programmers who selflessly helped me when I first entered the industry!
First of all, let's show you the renderings first (I will also give you the style, beautiful, right? Sao Nian!)!

The above picture uses two js, ​​Jquery and Layer. Please download it yourself (just click on the text for the link).
ok! The following officially begins! ~ Everyone pay attention to read the code carefully.
The first step is to download the official WeChat demo for configuration and deployment
. Give everyone a portal -> PHP WeChat payment demo download
and get the file, unzip it, and rename the folder to payment after unzipping (you can also change it at will, but the blogger feels that Be standardized like this!) Then upload it to the root directory of the project. If you don't know what the root directory is, please see this (/). Actually, I am teasing you.


Then enter the merchant background of WeChat, set the api key and look at the picture below (you can find it on the Internet ~ it's ugly, let's do it!) After setting, download the certificate file. Then unzip the certificate!

1. Set the key (as shown in the figure)

2. Download the certificate, get the compressed folder, unzip it and upload it to the cert in the payment! (As shown in the figure, there is a path on the figure)

3. Modify the configuration file WxPay.Config.php in the WeChat payment demo (as shown in the figure: path)

//Only modify lines 25, 26, 27, 28 (example)
const APPID = 'wx2a3f1e5246886123'; // APPID of WeChat public account
const MCHID = '1300778123'; //WeChat merchant number   
const KEY = '619fd0f3f9c64550964bbe5b94dba123'; //WeChat Merchant Key (the one set in the above steps)
const APPSECRET = '5c8289b72600936f813ec1939e68f123'; //APPSECRET of WeChat public account

WeChat scan code demo address: PHP WeChat payment demo download
ok! So far, the whole process is over! ~The above code is for reference only! ~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326443778&siteId=291194637