Home > php教程 > php手册 > body text

WeChat develops SDK (including payment) and supports Composer specifications

WBOY
Release: 2016-11-19 13:05:28
Original
4015 people have browsed it

Here, I recommend that you use composer to manage your SDK, especially the API library of volatile interface classes.
This SDK has been released in composer and can be managed using composer. Of course, it is very easy to integrate into thinkphp5.
Recommended by the author
Here, I recommend that you use composer to manage your SDK, especially the API library of volatile interface classes.
This SDK has been released in composer and can be managed using composer. Of course, it is very easy to integrate into thinkphp5.
For WeChat or other mobile terminal development, here is a SUI front-end framework based on jQuery http://sui.ctolog.com

SDK project related address
GITHUB source code address: https://github.com/zoujingli/wechat-php-sdk
OSChina source code address: http://git.oschina.net/zoujingli/wechat-php-sdk
Composer package name: zoujingli/wechat-php-sdk
Online document address: http://www.kancloud.cn/zoujingli/wechat-php-sdk

Special instructions for SDK
The minimum requirement for running this SDK is PHP version 5.3.3. It is recommended to run it on PHP7 for best performance.
Some interfaces of WeChat need to cache data locally, so write permissions are required for the directory.
We encourage everyone to use composer to manage your third-party libraries to facilitate later update operations (especially interface classes).
Recently, access_token often expires for no reason. The SDK adds failure status detection, reacquires access_token and returns the result.
This SDK has been verified and tested by several online projects, and its reliability and stability are extremely high. You are welcome to fork this project.

About WeChat Pay
WeChat payment can be mainly divided into two types, one requires a certificate and the other does not require a certificate.
Collect money from public accounts: WeChat page payment, WeChat scan code payment (no certificate required)
Payment through official account: WeChat order refund, corporate payment, WeChat red envelope (certificate required)
Of course, this SDK is fully supported. You will understand by looking at the parameters required for SDK configuration. ^_^$options = [<br> 'token' => '', //Fill in the token you set<br> 'appid' => '', //Fill in the app id of the advanced calling function, please check in the WeChat development mode background<br> 'appsecret' => '', //Fill in the key for advanced calling functions<br> 'encodingaeskey' => '', //Fill in the EncodingAESKey for encryption (optional, required for transmission encryption)<br> 'mch_id' => '', //WeChat payment, merchant ID (optional)<br> 'partnerkey' => '', //WeChat payment, key (optional)<br> 'ssl_cer' => '', //WeChat payment, two-way certificate (optional, required when operating refund or payment)<br> 'ssl_key' => '' //WeChat payment, two-way certificate (optional, required when operating refund or payment)<br> 'cachepath' => '', //Set the SDK cache directory (optional, the default is Wechat/Cache, write permission is required)<br> ]; Scan code payment DEMO based on ThinkPHP5

DEMO experience address: http://pay.test.ctolog.com/public/index.php
DEMO source code download: http://pay.test.ctolog.com/master.zip
DEMO source code analysis: http://www.kancloud.cn/zoujingli/wechat-php-sdk/213700
http://www.kancloud.cn/zoujingli/wechat-php-sdk/219111

Included WeChat payment interface (please read the document for details)
Generate WeChat prepayment ID (universal)
Initiate WeChat scan code NATIVE payment
Initiate JSAPI payment on WeChat webpage
WeChat payment order closing operation
WeChat payment order operation refund
WeChat payment order details inquiry
WeChat payment order operation refund status query
Get WeChat payment statement
WeChat official account sends cash red envelopes to fans
WeChat Cash Red Packet Status Inquiry
WeChat official account uses companies to send money to individuals
WeChat business payment status inquiry


About WeChat cross-account payment
The main problem with WeChat cross-account payment is that the openid of the payment official account and the authorized official account are inconsistent, which will cause some problems later.
For example: corporate payments, WeChat red envelopes, and WeChat refunds all require the use of the fan's openid, which is a bit troublesome. Of course, WeChat refunds are still possible, and there will be an openid in the payment notification.
For WeChat page payment, it mainly involves payment security configuration, which needs to be configured when paying the official account platform, while scanning the QR code to pay is much simpler and requires almost no special processing!

SDK package docking and functions
Access verification (primary authority)
Automatic reply (text, picture, voice, video, music, graphics) (Elementary permission)
Menu operations (query, create, delete) (menu permissions)
Customer service messages (text, pictures, voice, video, music, graphics) (authentication authority)
QR code (create temporary and permanent QR code, obtain QR code URL) (service number, authentication authority)
Long link to short link interface (service account, authentication authority)
Tag operations (query, create, modify, move users to tags) (authentication authority)
Web page authorization (basic authorization, user information authorization) (service account, authentication authority)
User information (query basic user information, obtain follower list) (authentication authority)
Multiple customer service functions (customer service management, obtaining customer service records, customer service session management) (authentication authority)
Media files (upload, obtain) (authentication authority)
Advanced group messaging (authentication)
Template message (set industry, add template, send template message) (service account, authentication authority)
Card and coupon management (creation, modification, deletion, issuance, store management, etc.) (authentication authority)
Semantic understanding (service account, authentication authority)
Get WeChat server IP list (junior authority)
WeChat JSAPI authorization (get ticket, get signature) (junior authority)
Data statistics (users, images, texts, messages, interface analysis data) (authentication authority)
WeChat payment (webpage payment, scan code payment, transaction refund, payment to fans) (certify service account and activate payment)

Remarks on interface permissions
Primary permissions: Basic permissions, any normal public account has this permission
Menu permissions: Normal service accounts and certified subscription accounts have this permission
Authentication permissions: It is divided into subscription account and service account authentication. If the prefix is ​​service account, only the certified service account has this permission. Otherwise, both the subscription account and service account after authentication have this permission
Payment permission: Only certified service accounts can apply for this permission

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!