PHPackages                             labs7in0/omnipay-wechat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. labs7in0/omnipay-wechat

Abandoned → [lokielse/omnipay-wechatpay](/?search=lokielse%2Fomnipay-wechatpay)ArchivedLibrary[Payment Processing](/categories/payments)

labs7in0/omnipay-wechat
=======================

WeChat driver for the Omnipay PHP payment processing library

v1.1.1(10y ago)3717.5k12MITPHP

Since Aug 12Pushed 10y ago6 watchersCompare

[ Source](https://github.com/labs7in0/omnipay-wechat)[ Packagist](https://packagist.org/packages/labs7in0/omnipay-wechat)[ Docs](https://github.com/labs7in0/omnipay-wechat)[ RSS](/packages/labs7in0-omnipay-wechat/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Omnipay-WeChat
==============

[](#omnipay-wechat)

**WeChat Payment driver for the Omnipay PHP payment processing library**

[![Build Status](https://camo.githubusercontent.com/c1be5534203af6ef159fff8a99e154eee21b3c2328c0c14fb4ee89396c0c5ba6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70726f6a6563742d646570726563617465642d7265642e737667)](https://github.com/labs7in0/omnipay-wechat)[![Build Status](https://camo.githubusercontent.com/41890ed380689de20833eac732182f44ae1f78a065db3d9f58b76f376615e645/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61627337696e302f6f6d6e697061792d7765636861742e737667)](https://travis-ci.org/labs7in0/omnipay-wechat)[![Coverage Status](https://camo.githubusercontent.com/02072b6c2e9b7ce83080360d445b9ac81c6c3a8c6734cae25e9da5dbd4aad67f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6c61627337696e302f6f6d6e697061792d7765636861742e737667)](https://codecov.io/github/labs7in0/omnipay-wechat)[![Packagist Status](https://camo.githubusercontent.com/6957dd266a792182f7fe4f5c5ae29fa2e64293523eb24c6adb4fe9fd3c6bca82/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61627337696e302f6f6d6e697061792d7765636861742e737667)](https://packagist.org/packages/labs7in0/omnipay-wechat)[![Packagist Downloads](https://camo.githubusercontent.com/1d3ab2e90b36baf98a3792d8c414d4f4c2063750c182e0f6cdfc0cbb8ed69bb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61627337696e302f6f6d6e697061792d7765636861742e737667)](https://packagist.org/packages/labs7in0/omnipay-wechat)

**Deprecated** We suggest you to use [@lokielse](https://github.com/lokielse)'s implementation of WeChatPay for Omnipay at [lokielse/omnipay-wechatpay](https://github.com/lokielse/omnipay-wechatpay).

There's a pre-built Payment Gateway based on Omnipay at [labs7in0/E-cash](https://github.com/labs7in0/E-cash).

Installation
------------

[](#installation)

Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file:

```
{
    "require": {
        "labs7in0/omnipay-wechat": "dev-master"
    }
}
```

And run composer to update your dependencies:

```
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

```

Basic Usage
-----------

[](#basic-usage)

The following gateways are provided by this package:

- WeChat Express (WeChat NATIVE)

For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)repository.

Example
-------

[](#example)

### Make a payment

[](#make-a-payment)

The WeChat NATIVE payment gateway return a URI which can be opened within WeChat In-App broswer, you can generate a QR code with the URI.

```
$omnipay = Omnipay::create('WeChat_Express');

$omnipay->setAppId('app_id'); // App ID of your WeChat MP account
$omnipay->setAppKey('app_key'); // App Key of your WeChat MP account
$omnipay->setMchId('partner_id'); // Partner ID of your WeChat merchandiser (WeChat Pay) account

$params = array(
    'out_trade_no' => time() . rand(100, 999), // billing id in your system
    'notify_url' => $notify_url, // URL for asynchronous notify
    'body' => $billing_desc, // A simple description
    'total_fee' => 0.01, // Amount with less than 2 decimals places
    'fee_type' => 'CNY', // Currency name from ISO4217, Optional, default as CNY
);

$response = $omnipay->purchase($params)->send();

$qrCode = new Endroid\QrCode\QrCode(); // Use Endroid\QrCode to generate the QR code
$qrCode
    ->setText($response->getRedirectUrl())
    ->setSize(120)
    ->setPadding(0)
    ->render();
```

### Verify a payment (especially for asynchronous notify)

[](#verify-a-payment-especially-for-asynchronous-notify)

`completePurchase` for Omnipay-WeChat does not require the same arguments as when you made the initial `purchase` call. The only required parameter is `out_trade_no` (the billing id in your system) or `transaction_id` (the trade number from WeChat).

```
$omnipay = Omnipay::create('WeChat_Express');

$omnipay->setAppId('app_id'); // App ID of your WeChat MP account
$omnipay->setAppKey('app_key'); // App Key of your WeChat MP account
$omnipay->setMchId('partner_id'); // Partner ID of your WeChat merchandiser (WeChat Pay) account

$params = array(
    'out_trade_no' => $billing_id, // billing id in your system
    //or you can use 'transaction_id', the trade number from WeChat
);

$response = $omnipay->completePurchase($params)->send();

if ($response->isSuccessful() && $response->isTradeStatusOk()) {
    $responseData = $response->getData();

    // Do something here
}
```

Donate us
---------

[](#donate-us)

[Donate us](https://7in0.me/#donate)

License
-------

[](#license)

The MIT License (MIT)

More info see [LICENSE](LICENSE)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Total

4

Last Release

3654d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/25e4423232bfcc04260c68148f553b6406dd5d11ea30357a438b19624be04d2e?d=identicon)[kinosang](/maintainers/kinosang)

---

Top Contributors

[![kinosang](https://avatars.githubusercontent.com/u/4987102?v=4)](https://github.com/kinosang "kinosang (17 commits)")

---

Tags

paymentgatewaypaymerchantomnipaypurchasewechat

### Embed Badge

![Health badge](/badges/labs7in0-omnipay-wechat/health.svg)

```
[![Health](https://phpackages.com/badges/labs7in0-omnipay-wechat/health.svg)](https://phpackages.com/packages/labs7in0-omnipay-wechat)
```

###  Alternatives

[lokielse/omnipay-alipay

Alipay gateway for Omnipay payment processing library

587421.0k11](/packages/lokielse-omnipay-alipay)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
