Home php教程 php手册 WeChat develops SDK (including payment) and supports Composer specifications

WeChat develops SDK (including payment) and supports Composer specifications

Nov 19, 2016 pm 01:05 PM

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

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Learn about introductory code examples for Python programming Learn about introductory code examples for Python programming Jan 04, 2024 am 10:50 AM

Learn about Python programming with introductory code examples Python is an easy-to-learn, yet powerful programming language. For beginners, it is very important to understand the introductory code examples of Python programming. This article will provide you with some concrete code examples to help you get started quickly. Print HelloWorldprint("HelloWorld") This is the simplest code example in Python. The print() function is used to output the specified content

PHP variables in action: 10 real-life examples of use PHP variables in action: 10 real-life examples of use Feb 19, 2024 pm 03:00 PM

PHP variables store values ​​during program runtime and are crucial for building dynamic and interactive WEB applications. This article takes an in-depth look at PHP variables and shows them in action with 10 real-life examples. 1. Store user input $username=$_POST["username"];$passWord=$_POST["password"]; This example extracts the username and password from the form submission and stores them in variables for further processing. 2. Set the configuration value $database_host="localhost";$database_username="username";$database_pa

Go language programming examples: code examples in web development Go language programming examples: code examples in web development Mar 04, 2024 pm 04:54 PM

"Go Language Programming Examples: Code Examples in Web Development" With the rapid development of the Internet, Web development has become an indispensable part of various industries. As a programming language with powerful functions and superior performance, Go language is increasingly favored by developers in web development. This article will introduce how to use Go language for Web development through specific code examples, so that readers can better understand and use Go language to build their own Web applications. 1. Simple HTTP Server First, let’s start with a

Java implements simple bubble sort code Java implements simple bubble sort code Jan 30, 2024 am 09:34 AM

The simplest code example of Java bubble sort Bubble sort is a common sorting algorithm. Its basic idea is to gradually adjust the sequence to be sorted into an ordered sequence through the comparison and exchange of adjacent elements. Here is a simple Java code example that demonstrates how to implement bubble sort: publicclassBubbleSort{publicstaticvoidbubbleSort(int[]arr){int

From beginner to proficient: Code implementation of commonly used data structures in Go language From beginner to proficient: Code implementation of commonly used data structures in Go language Mar 04, 2024 pm 03:09 PM

Title: From Beginner to Mastery: Code Implementation of Commonly Used Data Structures in Go Language Data structures play a vital role in programming and are the basis of programming. In the Go language, there are many commonly used data structures, and mastering the implementation of these data structures is crucial to becoming a good programmer. This article will introduce the commonly used data structures in the Go language and give corresponding code examples to help readers from getting started to becoming proficient in these data structures. 1. Array Array is a basic data structure, a group of the same type

Huawei Cloud Edge Computing Interconnection Guide: Java code examples to quickly implement interfaces Huawei Cloud Edge Computing Interconnection Guide: Java code examples to quickly implement interfaces Jul 05, 2023 pm 09:57 PM

Huawei Cloud Edge Computing Interconnection Guide: Java Code Samples to Quickly Implement Interfaces With the rapid development of IoT technology and the rise of edge computing, more and more enterprises are beginning to pay attention to the application of edge computing. Huawei Cloud provides edge computing services, providing enterprises with highly reliable computing resources and a convenient development environment, making edge computing applications easier to implement. This article will introduce how to quickly implement the Huawei Cloud edge computing interface through Java code. First, we need to prepare the development environment. Make sure you have the Java Development Kit installed (

How to use PHP to write inventory management function code in the inventory management system How to use PHP to write inventory management function code in the inventory management system Aug 06, 2023 pm 04:49 PM

How to use PHP to write the inventory management function code in the inventory management system. Inventory management is an indispensable part of many enterprises. For companies with multiple warehouses, the inventory management function is particularly important. By properly managing and tracking inventory, companies can allocate inventory between different warehouses, optimize operating costs, and improve collaboration efficiency. This article will introduce how to use PHP to write code for inventory warehouse management functions, and provide you with relevant code examples. 1. Establish the database before starting to write the code for the inventory warehouse management function.

Guidance and Examples: Learn to implement the selection sort algorithm in Java Guidance and Examples: Learn to implement the selection sort algorithm in Java Feb 18, 2024 am 10:52 AM

Java Selection Sorting Method Code Writing Guide and Examples Selection sorting is a simple and intuitive sorting algorithm. The idea is to select the smallest (or largest) element from the unsorted elements each time and exchange it until all elements are sorted. This article will provide a code writing guide for selection sorting, and attach specific Java sample code. Algorithm Principle The basic principle of selection sort is to divide the array to be sorted into two parts, sorted and unsorted. Each time, the smallest (or largest) element is selected from the unsorted part and placed at the end of the sorted part. Repeat the above

See all articles