PHPackages                             hardywen/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. [Payment Processing](/categories/payments)
4. /
5. hardywen/alipay

ActiveLibrary[Payment Processing](/categories/payments)

hardywen/alipay
===============

支付宝接口 Alipay payment interface

52995[2 issues](https://github.com/hardywen/alipay/issues)PHP

Since Mar 17Pushed 11y ago1 watchersCompare

[ Source](https://github.com/hardywen/alipay)[ Packagist](https://packagist.org/packages/hardywen/alipay)[ RSS](/packages/hardywen-alipay/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

\###Statement 本组件目前只支持手机网站(wap)快捷支付（即时到账）和 pc网站快捷支付(即时到账)。组件改自支付宝接口demo。【版本：3.3 日期：2012-07-23】。目的只是为了方便自己使用，所以没有进行严格测试，只在本人项目中测试通过并使用(用的是wap支付，web支付没怎么测试)。在你使用本组件前，强烈建议你先使用支付宝demo测试，并了解支付流程。

\###Install

1.将 `'hardywen/alipay': 'dev-master'` 加入composer.json文件 (Add `'hardywen/alipay': 'dev-master'` to composer.json)

```
"require": {
	  "laravel/framework": "4.2.*",
	  "..."
	  "hardywen/alipay": "dev-master"
},
```

2.运行`composer update` 安装本组件 (run `composer update` to install this service)

3.在`app/config/app.php`中加入以下配置 (Add below config to `app/config/app.php`)

```
	'providers' => array(
	    '...',
	    'Hardywen\Alipay\AlipayServiceProvider',
	)

	'aliases' => array(
	    '...',
	    'Alipay'            => 'Hardywen\Alipay\Facades\AlipayFacade',
	)
```

\###Config

4.运行下面这条命令(Run comment below)

`php artisan config:publish hardywen/alipay`

5.运行上面命令后，可以在 `app/config/packages/hardywen/alipay/config`里配置支付宝的相关参数 （After step 4, you can config your Alipay configurations in `app/config/packages/hardywen/alipay/config`）

\###Usage

6.支付样例(Payment Example)

```
$pay = Alipay::instance('web'); // 如果要使用wap支付，则使用 $pay = Alipay::instance('wap')
$config = [
	"notify_url"	=> 'http://xxx.com/notify_url', // 异步通知地址
	"return_url"	=> 'http://xxx.com/call_back_url',//前台跳转地址【注意：】wap支付则是 call_back_url 参数（支付宝接口真不统一！）
	"out_trade_no"	=> 'xxxxxxxx', //订单号
	"subject"	=> 'test',
	"total_fee"	=> '0.01',
	//"body"	=> '测试',
	"show_url"	=> 'http://xxx.com/show_url'
];

//setConfig()方法将传入的配置参数与配置文件中的参数合并，
//如果有相同的参数项，配置文件中的配置将会被传入的新配置覆盖。

$form = $pay->setConfig($config)->buildRequestForm(); // 将生成一个支付表单,并使用js提交表单,
// 还提供一个只生成支付链接的方法 buildRequestUrl();
return Response::make($form);
```

7.回调样例(Notify Example)

```
$pay = Alipay::instance('web');

$notify_result = $pay->verifyNotify();

if($notify_result == true){

	//执行你的业务逻辑，例如更新订单状态，记录支付情况等等

	//如果是wap支付，那么可以使用 $pay->getNotifyData() 方法获取回调的notify_data数据。
	//**注意** 只针对wap支付，只获取notify_data字段数据，并非所有回调数据。所有数据你可以使用$_POST或Input::all()获取

	die('success'); // 处理完成后必须返回 success 告诉支付宝。
					//**注意** 只能返回success，不能带有其他东西。
}else{
	//验证失败 执行你的业务逻辑
}
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/730b1d31144cf283dd5a4f979a32cff0fec848d33fd13bbe6488c5509417f6c7?d=identicon)[hardywen](/maintainers/hardywen)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[msilabs/bkash

bKash Payment Gateway API for Laravel Framework.

181.2k](/packages/msilabs-bkash)

PHPackages © 2026

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