PHPackages                             juchengit/alipay - 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. juchengit/alipay

ActiveLibrary

juchengit/alipay
================

This is Jucheng Alipay model

1.5(6y ago)012Apache-2.0PHPPHP &gt;=7.0.0

Since Sep 7Pushed 6y agoCompare

[ Source](https://github.com/hezhijucheng/alipay)[ Packagist](https://packagist.org/packages/juchengit/alipay)[ Docs](http://www.jucheng01.net/)[ RSS](/packages/juchengit-alipay/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

alipay
======

[](#alipay)

===

支付宝支付
-----

[](#支付宝支付)

目前只支持支付宝的app唤起支付、回调、退款：

安装
--

[](#安装)

### Composer

[](#composer)

alipay采用composer进行安装，要使用alipay功能，只需要在composer.json中添加如下依赖：

```
{
  "require": {
    "juchengit/alipay": "1.*"
  }
}
```

### 手动

[](#手动)

1. 手动下载或clone最新版本alipay代码
2. 把alipay放入项目目录
3. `require` alipay src目录下面的AlipayClient.php，即可使用，如把alipay放在当前目录下，只需要:

```
require __DIR__ . "/alipay/src/AlipayClient.php";
```

用法
--

[](#用法)

- **准备必要参数**

```
//AppID
$appid = 1400009099;

// 用户私钥
$rsaPrivateKey = "用户私钥";

//支付宝公钥
$alipayrsaPublicKey="支付宝公钥";

//支付回调地址
$notifyUrl="https://www.baidu.com";
```

- **app唤起支付**

```
use alipay;
$app_client=new alipay\AlipayClient($appid,$rsaPrivateKey,$alipayrsaPublicKey);
$data["total_amount"]="0.01";
$data["subject"]="预定酒店消费";
$data["out_trade_no"]="JD201909051809240201";
$data["product_code"]="QUICK_MSECURITY_PAY";
$result=$app_client->appPay($data,$notifyUrl);
```

> `Note` 如需要自定义data参数 请查看支付宝官方文档 [https://docs.open.alipay.com/api\_1/alipay.trade.app.pay](https://docs.open.alipay.com/api_1/alipay.trade.app.pay)`Note` 将$result传给手机端唤起支付。

- **回调参数验签**

```
use alipay;
$app_client=new alipay\AlipayClient($appid,$rsaPrivateKey,$alipayrsaPublicKey);
$flag = $app_client->rsaCheckV1($_POST, NULL, "RSA2");
```

> `Note` 对$flag进行操作。

- **退款**

```
use alipay;
$app_client=new alipay\AlipayClient($appid,$rsaPrivateKey,$alipayrsaPublicKey);
$data["out_trade_no"]="JD201909051809240201";
$data["trade_no"]="2019090922001444760542604693";
$data["refund_amount"]="0.01";
$result=$app_client->refundOrder($data);
```

> `Note` 退款是否成功对$result进行判断。

> `Note` 所有方法错误码请以官方错误码为准 [https://docs.open.alipay.com/api\_1/alipay.trade.app.pay](https://docs.open.alipay.com/api_1/alipay.trade.app.pay)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

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

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

2433d ago

### Community

Maintainers

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

---

Top Contributors

[![rrrag](https://avatars.githubusercontent.com/u/20294043?v=4)](https://github.com/rrrag "rrrag (14 commits)")[![hezhijucheng](https://avatars.githubusercontent.com/u/55120720?v=4)](https://github.com/hezhijucheng "hezhijucheng (2 commits)")

---

Tags

alipayJucheng

### Embed Badge

![Health badge](/badges/juchengit-alipay/health.svg)

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

###  Alternatives

[yansongda/pay

可能是我用过的最优雅的 Alipay 和 WeChat 的支付 SDK 扩展包了

5.3k1.2M53](/packages/yansongda-pay)[yansongda/laravel-pay

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

1.1k353.2k9](/packages/yansongda-laravel-pay)[zoujingli/wechat-developer

WeChat and Alipay Platform Development

1.6k136.9k14](/packages/zoujingli-wechat-developer)[lokielse/omnipay-alipay

Alipay gateway for Omnipay payment processing library

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

支付宝SDK在Laravel5封装包。

40349.2k](/packages/latrell-alipay)[yansongda/hyperf-pay

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

8959.8k1](/packages/yansongda-hyperf-pay)

PHPackages © 2026

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