Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of the official account payment code of Wechat of PHP SDK

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

PHP SDK Wechat official account of the detailed explanation of the payment code, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

It is assumed that you have already applied for WeChat Pay.

1. The backend configuration of Wechat is shown in the picture.

We test first, so first add the test authorization directory and test whitelist. The test authorization directory is the directory where the file from which you want to initiate the Wechat request is located.

For example, when jsapi initiates a request, the directory where the jsapi.php is located is the test directory, and the test whitelist is the developer's WeChat account.

The formal payment authorization directory cannot be the same as the one tested or an error will be reported. Failure to fill in or incorrectly fill in the authorization directory and the test whitelist will report an error.

Sample error report:

NaNsystem:access_denied

Not testing the whitelist.

two。 Configure the lib/WxPay.Config.php file

The four main configurations are as follows:

Const APPID =''

Const MCHID =''

Const KEY =''

Const APPSECRET =''

Both APPID and APPSECRET can be found in the backstage of Wechat.

MCHID can be found in the email sent after applying for WeChat Pay, while KEY can follow the email prompt.

Go to the merchant platform to configure it.

3. Access the starting index.php

Visit index.php first and you can see the interface.

The first thing we need is JSAPI payment. But look at the link at the bottom of the code index.php. By default, it is a demo link, which can be changed to our custom one.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report