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

ActiveLibrary[Payment Processing](/categories/payments)

ycpfzf/pay
==========

wechat &amp; alipay

0.6.2(4y ago)0771Apache-2.0PHPPHP &gt;=7.0.0CI failing

Since Apr 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mynameisfzf/pay)[ Packagist](https://packagist.org/packages/ycpfzf/pay)[ Docs](https://github.com/mynameisfzf/pay)[ RSS](/packages/ycpfzf-pay/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

使用方法
----

[](#使用方法)

测试完善中....

### 安装

[](#安装)

1 使用composer安装依赖

```
composer require ycpfzf/pay
```

2 发布资源

```
php artisan vendor:publish
```

在列表中选择 Ycpfzf\\Pay\\ServiceProvider，运行完毕会在config文件夹生成配置文件pay.php env文件配置示例

```
ALI_APP_ID=
ALI_PUBLIC_KEY=
ALI_PRIVATE_KEY=
WECHAT_APP_ID=
WECHAT_MINIAPP_ID=
WECHAT_APPID=
WECHAT_MCH_ID=
WECHAT_KEY=
```

### 使用

[](#使用)

#### 支付

[](#支付)

- alipay() 使用支付宝支付
- wechat() 使用微信支付
- money($money) 支付金额，不管是支付宝还是微信，统一单位是元。
- outTradeNo($out\_trade\_no) 商户定义的支付订单号
- subject($subject) 支付说明
- openid($openid) JSAPI支付必须传openid

各支付类型详见[文档](https://pay.yanda.net.cn/docs/2.x)

```
use Ycpfzf\Pay\Pay;

Pay::alipay()->outTradeNo($outid)->money(0.1)->subject('测试')->app(); //使用支付宝的app支付0.1元
```

#### 退款

[](#退款)

- 退款方法 refund($type='',$orderTotalFee=0)
- $type表示类别 ，微信app支付的是app,微信小程序支付的是miniapp,其它方式不用
- $orderTotalFee表示订单金额，为0时表示和退款金额一样，支付宝不用

```
use Ycpfzf\Pay\Pay;

Pay::wechat()->outTradeNo($outid)->money(0.1)->subject('7天无理由退款')->refund('app');

//返回结果
[
    'status'=>true,  //退款是否成功
    'trade_no'=>'xxxx'  //平台返回的退款编号
]
```

#### 异步通知

[](#异步通知)

- 通知方法 notify($callback)

```
use Ycpfzf\Pay\Pay;

Pay::notify(function($data){

       .....
});

//回调函数中参数$data
[
    'out_trade_no'=>'xxx'  //商户订单编号
    'status'=>true,  //支付是否成功
    'notify_no'=>//平台编号,
    'money'=>0.10  //支付金额，单位统一都是元,
    'appid'=>'xxx',   //商户申请的appid
    'mch_id'=>'xxx',  //微信时返回mch_id,支付宝返回0
    'type'=>'wechat',  //类别 wechat 或 alipay

]
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

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

Total

3

Last Release

1513d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8e4cc02d26b969a51636be10a2c569dbc2dfec3b0f7c5f3d170ee75ae5d867d?d=identicon)[ycpfzf](/maintainers/ycpfzf)

---

Top Contributors

[![ysfzf](https://avatars.githubusercontent.com/u/20126315?v=4)](https://github.com/ysfzf "ysfzf (12 commits)")

---

Tags

laravelpayalipaywechat

### Embed Badge

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

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

###  Alternatives

[yansongda/laravel-pay

专注 Alipay/WeChat/Unipay 的 laravel 支付扩展包

1.1k353.2k9](/packages/yansongda-laravel-pay)[yansongda/hyperf-pay

可能是基于 hyperf 的最优雅的支付宝、微信、银联支付 SDK 了

8959.8k1](/packages/yansongda-hyperf-pay)[guanguans/yii-pay

适配于 Yii 的 alipay 和 wechat 的支付扩展包

515.5k](/packages/guanguans-yii-pay)

PHPackages © 2026

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