PHPackages                             dsweixin/pay - 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. dsweixin/pay

ActiveLibrary[Payment Processing](/categories/payments)

dsweixin/pay
============

pay wechat alipay php

1.0.7(7y ago)044MITPHPPHP &gt;=5.4.0

Since May 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/xiongjinhai/pay)[ Packagist](https://packagist.org/packages/dsweixin/pay)[ RSS](/packages/dsweixin-pay/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

适合laravel框架使用
=============

[](#适合laravel框架使用)

### Composer

[](#composer)

Execute the following command to get the latest version of the package:

```
composer require dsweixin/pay

```

Publish Configuration

```
php artisan vendor:publish --provider "Pay\WeChat\WeChatServiceProvider"
```

```
config目录下面会生成pay.php文件配置相关参数

```

Methods
-------

[](#methods)

### 小程序支付创建订单

[](#小程序支付创建订单)

```
use Pay\WeChat\Facades\WeChat;

// 4. 组装参数，可以参考官方商户文档
$data = [
    'body'             => '测试商品',
    'out_trade_no'     => time(),
    'total_fee'        => '1',
    'openid'           => 'o8jfi5KadnMGFAG2pBkTwnnT3kGI',
    'spbill_create_ip' => '127.0.0.1',
    'trade_type'       => 'JSAPI',
    'notify_url'       => config('pay.notify_url'),
];
$result  =  WeChat::createOrder($data);
// 创建JSAPI参数签名
$options = WeChat::createParamsForJsApi($result['prepay_id']);

```

### 小程序支付回调处理

[](#小程序支付回调处理)

```
use Pay\WeChat\Facades\Notify;

Notify::handle(false);

上面代码放回调通知地址方法即可
$data = Array
(
    [result] => 1
    [data] => Array
        (
            [appid] => wx05ad3d3ccbea8ce6
            [bank_type] => CFT
            [cash_fee] => 2000
            [fee_type] => CNY
            [is_subscribe] => N
            [mch_id] => 1503359491
            [nonce_str] => nccypuj8s8y1ppcto60u4nwww6uvpd0d
            [openid] => o8jfi5KadnMGFAG2pBkTwnnT3kGI
            [out_trade_no] => 5990579967388781001
            [result_code] => SUCCESS
            [return_code] => SUCCESS
            [sign] => E4895BA374A65DC1599D062A60AF7882
            [time_end] => 20180518140320
            [total_fee] => 2000
            [trade_type] => JSAPI
            [transaction_id] => 4.2000001282018E+27
        )

    [return_code] => SUCCESS
    [return_msg] => OK
)
 //在业务逻辑处理好添加下面一段代码ok,处理失败也需要输出这段
 $xml = array(
     "return_code" => $data["return_code"],
     "return_msg"  => $data["return_msg"],
 );
 Notify::ReplyNotify($xml);

```

### 小程序校验和解密

[](#小程序校验和解密)

```
use Pay\WeChat\Facades\Oauth;

Oauth::jsCodeSession($code);//登录凭证校验

Oauth::wxBizDataCrypt($data);//用户数据的签名验证和加解密

```

##### [微信API](https://developers.weixin.qq.com/miniprogram/dev/api/signature.html#wxchecksessionobject)

[](#微信api)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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 ~8 days

Total

7

Last Release

2916d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16200769?v=4)[xiongjinhai](/maintainers/xiongjinhai)[@xiongjinhai](https://github.com/xiongjinhai)

---

Top Contributors

[![xiongjinhai](https://avatars.githubusercontent.com/u/16200769?v=4)](https://github.com/xiongjinhai "xiongjinhai (13 commits)")

### Embed Badge

![Health badge](/badges/dsweixin-pay/health.svg)

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

###  Alternatives

[omnipay/coinbase

Coinbase driver for the Omnipay payment processing library

18570.2k1](/packages/omnipay-coinbase)

PHPackages © 2026

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