Home > Article > Backend Development > How to complete WeChat payment with phpsdk+jsapi?
First download php_sdk from WeChat official website, the folder will contain several important php files WxPay.Api.php, WxPay.Config.php, etc.
Open your wxpay.config.php file to configure the relevant information of WeChat payment, the APPID bound to the payment (must be configured, can be viewed in the account opening email), merchant number, merchant payment key
Set the merchant certificate path, certificate path, note that the absolute path should be filled in (only required for refunds and order cancellations, you can log in to the merchant platform to download, and fill in the path of the certificate after downloading
in static Add an online payment button to the page and write relevant instructions. For example, the payment button is online payment. When clicked, the click event is triggered onClick="callpay()"
in callpay To add the WeChat payment method, the important WeChat payment files WxPay.JsApiPay.php,lib/WxPay.Api.php
should also be introduced on the page. Instantiate the jsapipay class in and configure the relevant information, title, order number, amount, and callback address
Finally, click Pay Now. If there are no program problems, the payment window will pop up. Enter payment. Password, you can complete the online payment, and then configure the payment completion operations you want on the callback page, modify the order status, etc.
Recommendation: php server
The above is the detailed content of How to complete WeChat payment with phpsdk+jsapi?. For more information, please follow other related articles on the PHP Chinese website!