Library / SDK
Yurunsoft/PaySDK avatar
Yurunsoft/PaySDK

PaySDK: a PHP payment library for Alipay and WeChat Pay

PHP 集成支付 SDK ,集成了支付宝、微信支付的支付接口和其它相关接口的操作。支持 php-fpm 和 Swoole,所有框架通用。宇润PHP全家桶技术支持群:17916227

888 stars182 forksPHPMIT

At a glance

What is it?
PaySDK is a PHP integration library for Alipay and WeChat Pay with no framework dependency, a request object per payment channel, and support for running inside Swoole coroutines. It suits a PHP team that has to keep an existing Alipay or WeChat integration working while adding channels.
Who is it for?
PaySDK is a good fit for a PHP team maintaining an existing Alipay or WeChat Pay integration, or adding a second channel to one, since the library has no framework dependency and covers a wide range of payment methods across both providers.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 23 days ago.
What is it written in?
Mainly PHP, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Two providers, many payment methods, one request object per channel

The scope is Chinese payment gateways, and the coverage is wide. The library integrates the Alipay and WeChat Pay payment interfaces and the related operations around them, and the supported interface list is long enough to be the main reason to look at it. For Alipay there is the older instant payment for desktop and mobile web, the face-to-face payment, the newer mobile web and desktop web payments, the app payment server side, the mini program payment, a single transfer to an Alipay account, overseas payment across desktop web, mobile web, app and QR code, customs declaration, and the auxiliary transaction interfaces such as refunds and queries. For WeChat Pay there is the swipe payment, the official account payment, the scan to pay, the app payment, the H5 payment, the mini program payment, transfers to the change balance and to a bank card, overseas payment in four forms, customs declaration, and the same auxiliary refund and query interfaces. Each combination is a separate class rather than one configurable request, so the class name is what selects the channel.

How a call is structured

The pattern is consistent across channels. You instantiate the SDK for the provider with the common configuration, then create a request object for the specific method, fill in the fields, and either redirect the user or execute the call. The Alipay desktop example sets the notify URL for the asynchronous callback, the return URL for the browser redirect, and then the business parameters, which include the seller's Alipay identifier, the merchant order number, the price and the product subject, and finally asks the SDK to prepare the execution and hand back the URL to redirect to. The WeChat H5 example follows the same shape with the WeChat SDK class and the H5 request object, setting the body, the merchant order number, the total fee in the smallest currency unit, the client IP and the async notification address, then calling execute and checking the result, and reading an error code and error message if the call failed. The notify URL is the field to watch. The documentation comments on it note that it is the reliable one, because it is the payment success callback, and the return URL is where the browser comes back to.

Swoole support is the part that sets it apart

The library works in php-fpm and in a Swoole coroutine environment, and the mechanism for the second is specific enough to be worth reading. In the payment and refund asynchronous notification, you have to assign Swoole's Request and Response objects, or objects following the PSR-7 standard. The main frameworks' request and response objects generally follow PSR-7 and can be used directly. The imi framework, which is a high performance coroutine application framework on top of PHP Swoole supporting HTTP, WebSocket, TCP and UDP services, is the case the documentation walks through. The pattern is an anonymous class extending the WeChat Pay notification class, with the subsequent work done in a protected exec method, and then the request and response are attached to it before the notify call, and the response has to be returned from the controller or assigned to the context, with the documentation noting the operation differs by framework. The two lines that attach the request and the response are the ones the comments single out as the important ones, because without them the callback has nothing to write the payment notification to.

The installation path and what the two major versions mean

The package is on Packagist as yurunsoft/pay-sdk and is added to composer.json, and there are two version lines with different requirements and different promises. The 3.x line requires PHP 5.5 or newer and is under continued iteration, and the 2.x line requires PHP 5.4 or newer and is described as receiving long term bug fixes with stability guaranteed, with functional updates stopped.

json
{
    "require": {
        "yurunsoft/pay-sdk": "~3.0"
    }
}

After changing the requirement you run the composer update command. The split is a reasonable pattern for a library whose audience is split between teams that want new features and teams that cannot afford a breaking change, but it also means the two lines will diverge, and the 2.x line is explicitly frozen functionally. The badge in the readme header shows the PHP 5.5 floor, and the composer package metadata for the repository lists the same. The source layout is conventional for a PHP library, with a src directory, a test directory, a res directory and the composer manifest, and the API documentation is hosted separately with an online technical guide linked from the readme.

Maintenance mode is stated plainly, and it is the deciding fact

The introduction section contains a sentence that changes how you should read the rest of the repository. It says the project has entered maintenance mode, will not support the WeChat V3 interface, and suggests looking elsewhere if that is needed. That is an unusual thing to find in a project readme, and it is a direct answer to a question a payment library has to answer. The WeChat V3 interface is the newer generation of the WeChat Pay API, and a library that does not implement it cannot be used for a new WeChat merchant integration, however complete its V2 coverage looks. The release history is consistent with the statement without explaining it. The three listed releases are v3.1.9 on 2026-09-30, v3.1.8 on 2026-07-19, and v3.1.7 on 2024-09-02, so there is a two year gap between the third and the second most recent, which is the pattern of a library that gets occasional maintenance rather than continuous development. The author also states that no technical support is provided, directing questions to a chat group where a reply is not guaranteed, and asking for pull requests to broaden the payment platform coverage.

What else is in the repository

There is a commercial services section alongside the open source project, offering low fee merchant account opening for legitimate merchants only, problem diagnosis and consultation, payment integration on their behalf, and other cooperation, with a contact route given for those who want it. That is worth knowing about because it tells you the maintainer is a commercial integrator as well as an open source author, which explains both the breadth of the channel coverage and the fact that support comes through a group chat rather than an issue tracker. The repository also carries a donation section with a payment QR code and a note that the project is open source and not seeking profit. The licence is MIT, as stated in the readme and in the repository licence field, and the default branch is dev rather than master, with the most recent tagged releases on that line. The package description names the supported runtimes, and the repository topics list the specific integrations, covering the Alipay SDK, the WeChat Pay SDK, payments, coroutine support and Swoole.

Editorial conclusion

PaySDK is a good fit for a PHP team maintaining an existing Alipay or WeChat Pay integration, or adding a second channel to one, since the library has no framework dependency and covers a wide range of payment methods across both providers. It is the wrong choice for a new project, because the documentation states plainly that the project is in maintenance mode and will not support the WeChat V3 interface, so you would be starting on a library that will not follow the platform. It is also the wrong choice if you need active upstream support, since the author states that no technical support is provided and directs questions to a chat group where a reply is not guaranteed. Before adopting it, confirm which WeChat interface your merchant account actually uses, and treat the release gap between v3.1.7 in 2024 and v3.1.8 in 2026 as a signal about how much attention the code is getting. The licence is MIT, the default branch is dev, and the last push was on 2026-09-30.

Frequently asked questions

Which payment methods does PaySDK support?

For Alipay it covers the older instant payment for desktop and mobile web, face-to-face payment, mobile web and desktop web payment, app payment server side, mini program payment, single transfer to an account, overseas payment, customs declaration and the auxiliary refund and query interfaces. For WeChat Pay it covers swipe payment, official account payment, scan to pay, app payment, H5 payment, mini program payment, transfers to balance and to a bank card, overseas payment, customs declaration and the auxiliary interfaces.

Does PaySDK work with Swoole and coroutine frameworks?

Yes. In the payment and refund asynchronous notification you assign Swoole's Request and Response objects, or PSR-7 compliant objects, to the notification instance, and the response has to be returned from the controller or set in the context. The documentation walks through it with the imi framework and also gives versions for other frameworks using Swoole objects and for those using PSR-7 objects.

How do I install PaySDK in a composer project?

Add yurunsoft/pay-sdk to the require section of your composer.json, using the ~3.0 constraint for PHP 5.5 and newer or ~2.0 for PHP 5.4 and newer, and then run the composer update command. The 3.x line is under continued iteration while 2.x receives long term bug fixes with functional updates stopped.

Is PaySDK still actively developed?

It is in maintenance mode, and the documentation says so, adding that the WeChat V3 interface will not be supported and suggesting looking elsewhere if that is what you need. The releases are v3.1.9 on 2026-09-30, v3.1.8 on 2026-07-19 and v3.1.7 on 2024-09-02, and the author states that no technical support is provided.

Does PaySDK depend on a framework?

No. The library has no framework dependency, works with all frameworks, and supports Swoole coroutine environments as well as php-fpm. The licence is MIT, and the default branch is dev with the latest release tagged v3.1.9 on 2026-09-30.

Official sources

  1. Issues
  2. License: MIT
  3. README
  4. Releases
  5. Yurunsoft/PaySDK on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/yurunsoft-paysdk.svg)](https://hysenlabs.com/projects/yurunsoft-paysdk)

Was this useful?