PHPackages                             hongcaideng/wxpay - 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. hongcaideng/wxpay

ActiveLibrary[Payment Processing](/categories/payments)

hongcaideng/wxpay
=================

微信支付 微信js支付 Weixin weixinPay

245PHP

Since Sep 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/denghongcai/wxpay)[ Packagist](https://packagist.org/packages/hongcaideng/wxpay)[ RSS](/packages/hongcaideng-wxpay/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

WxPay
=====

[](#wxpay)

WeiXin Payment

\###微信支付的配置要点：请留心注意本部分内容，因为这很可能是你遇到的大坑。 1.网页授权（设置错误会出现redirect\_url参数错误的错误） 这个网页授权需要登录微信公众平台，点击左侧菜单“开发者中心”，在右侧“权限列表”中找到“网页账号”，点击最右侧的修改，把测试的网址写进去，不要加http。

2.支付授权目录（设置不对会无法发起js支付，因为没有权限，错误为：“getBrandWCPayRequest:fail\_no permission to execute” ） 设置好授权目录即可。

\###Install

1. 修改composer.json文件,加入`"hongcaideng/wxpay": "dev-master"`

```
  "require": {
    "hongcaideng/wxpay": "dev-master"
  }
```

2. 修改app/config/app.php

```
'providers' => array(
  	HongcaiDeng\Wxpay\WxpayServiceProvider::class
)

'aliases' => array(
	'Wxpay' => HongcaiDeng\Wxpay\Facades\Wxpay::class,
)
```

3. 运行`composer update `命令
4. 如有必要修改支付页面，运行`php artisan vendor publish`

\###Usage

支付调用示例

```
  $config = array(
    'body'=>'',
    'total_fee' =>'',
    'out_trade_no' => $order->id,
    'js_api_call_url' => action('OrderController@pay', ['id' => $order->id]),
    ...
  );
  list($prepay_id, $view) = Wxpay::instance('jsApi')->setConfig($config)->pay();
```

支付回调

```
  $wxpay = Wxpay::instance('jsApi');
  list($notify, $data) = $wxpay->verifyNotify(); //验证回调

  if($notify){
    //业务逻辑

    $wxpay->setReturnParameter("return_code","SUCCESS");//设置返回码
    $wxpay->returnXml();
  }else{

    //业务逻辑

    $wxpay->setReturnParameter("return_code","FAIL");//返回状态码
    $wxpay->setReturnParameter("return_msg","签名失败");//返回信息
    $wxpay->returnXml();
  }
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.5% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/14a1117b01334864004397056dd9a3e0f5b1566e6efadc530ec84d5b8810dfba?d=identicon)[denghongcai](/maintainers/denghongcai)

---

Top Contributors

[![denghongcai](https://avatars.githubusercontent.com/u/1433247?v=4)](https://github.com/denghongcai "denghongcai (17 commits)")[![hardywen](https://avatars.githubusercontent.com/u/7113324?v=4)](https://github.com/hardywen "hardywen (16 commits)")

### Embed Badge

![Health badge](/badges/hongcaideng-wxpay/health.svg)

```
[![Health](https://phpackages.com/badges/hongcaideng-wxpay/health.svg)](https://phpackages.com/packages/hongcaideng-wxpay)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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