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

ActiveLibrary[Payment Processing](/categories/payments)

gzdsx/alipay-sdk
================

PHP SDK for Alipay

1.1.0(3y ago)028MITPHPPHP ^7.0

Since Mar 22Pushed 3y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

支付宝SDK
======

[](#支付宝sdk)

### 开始

[](#开始)

> composer require gzdsx/alipay-sdk

### 注册APP

[](#注册app)

在应用入口处注册，如Laravel的AppSericeProvider的boot处

```
AlipaySdk::register('支付宝私钥','支付宝公钥','默认通知地址','默认返回地址');
```

### 创建订单

[](#创建订单)

```
$order = new AlipayUnifiedOrderBuilder();
$order->out_trade_no = time();
$order->subject = '测试商品';
$order->total_amount = 100;
```

### APP支付

[](#app支付)

```
AlipaySdk::appPay()
->setBizContent($order->getBizContent())
->createPayStr();
```

### 网页支付

[](#网页支付)

```
AlipaySdk::pagePay()
->setBizContent($order->getBizContent())
->buildRequestForm();
```

### 订单查询

[](#订单查询)

```
AlipaySdk::query()->setBizContent(['out_trade_no'=>'你的订单号'])->sendRequest();
```

### 关闭订单

[](#关闭订单)

```
AlipaySdk::close()->setBizContent(['out_trade_no'=>'你的订单号'])->sendRequest();
```

### 退款

[](#退款)

```
$order = new AlipayRefundOrderBuilder();
$order->out_trade_no = '你的订单号';
$order->refund_amount = '退款金额';
$order->refund_reason = '退款原因';

AlipaySdk::refund()->setBizContent($order->getBizContent())->sendRequest();
```

### 退款查询

[](#退款查询)

```
AlipaySdk::refundQuery()->setBizContent(['out_trade_no'=>'你的订单号'])->sendRequest();
```

### 打赏作者

[](#打赏作者)

[![微信支付](https://camo.githubusercontent.com/27fea472adc2e2041940dfd46a7c0ca9ce41ad05ccb2a0ec5474b94be13584af/68747470733a2f2f73686f702e677a6473782e636e2f73746f726167652f696d6167652f323032332f30332f7a55344a7841475972616e614e5a354c496962717154356e6667493071544a7a6e4c307a566738662e6a7067)](https://camo.githubusercontent.com/27fea472adc2e2041940dfd46a7c0ca9ce41ad05ccb2a0ec5474b94be13584af/68747470733a2f2f73686f702e677a6473782e636e2f73746f726167652f696d6167652f323032332f30332f7a55344a7841475972616e614e5a354c496962717154356e6667493071544a7a6e4c307a566738662e6a7067)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

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

Unknown

Total

1

Last Release

1144d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/516a1402ec250146a1a792db0bba95db62c233305e7267193a8f0567be3d495f?d=identicon)[贵州大师兄](/maintainers/%E8%B4%B5%E5%B7%9E%E5%A4%A7%E5%B8%88%E5%85%84)

---

Top Contributors

[![xy113](https://avatars.githubusercontent.com/u/13481027?v=4)](https://github.com/xy113 "xy113 (5 commits)")

---

Tags

alipayalipaysdk

### Embed Badge

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

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

###  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)[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)[lokielse/omnipay-global-alipay

Alipay global gateway for Omnipay payment processing library

3048.9k](/packages/lokielse-omnipay-global-alipay)

PHPackages © 2026

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