PHPackages                             php-cpm/omnipay-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. php-cpm/omnipay-alipay

ActiveLibrary[Payment Processing](/categories/payments)

php-cpm/omnipay-alipay
======================

Alipay gateway for Omnipay payment processing library

v3.0.6(7y ago)33721MITPHP

Since Feb 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/php-cpm/omnipay-alipay)[ Packagist](https://packagist.org/packages/php-cpm/omnipay-alipay)[ Docs](https://github.com/php-cpm/omnipay-alipay)[ RSS](/packages/php-cpm-omnipay-alipay/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (3)Versions (59)Used By (0)

Omnipay: Alipay
===============

[](#omnipay-alipay)

[![travis](https://camo.githubusercontent.com/210c08ea7006ed09e729badb41c13332ce3dd617ab9defdecacf40fbab580da5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7068702d63706d2f6f6d6e697061792d616c697061792f6d61737465722e737667)](https://travis-ci.org/php-cpm/omnipay-alipay)[![Latest Version on Packagist](https://camo.githubusercontent.com/39658edddb357dcb07c7855dada47d556686c6f702e44d9618be2cb1b71c0c5d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d63706d2f6f6d6e697061792d616c697061792e737667)](https://packagist.org/packages/php-cpm/omnipay-alipay)[![Total Downloads](https://camo.githubusercontent.com/716e9046630b343ad7bc91d305c711aec5e3d0e7eabd9016d9cd6ef4ef703f24/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d63706d2f6f6d6e697061792d616c697061792e737667)](https://packagist.org/packages/php-cpm/omnipay-alipay)[![Code Coverage](https://camo.githubusercontent.com/8de75c96f554d68a1aabdb8e79cd79f744c1747011ea351248c60eb56ebaa6bd/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7068702d63706d2f6f6d6e697061792d616c697061792f6d61737465722e737667)](https://codecov.io/github/php-cpm/omnipay-alipay?branch=master)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)

**Alipay driver for the Omnipay PHP payment processing library**

[Omnipay](https://github.com/omnipay/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.6. This package implements Alipay support for Omnipay.

this lib now base on omnipay common v3.0-alpha.1 to be able stay on php 5.6

Installation
------------

[](#installation)

Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file:

```
"php-cpm/omnipay-alipay": "^3.0",

```

And run composer to update your dependencies:

```
$ composer update -vvv

```

Basic Usage
-----------

[](#basic-usage)

The following gateways are provided by this package:

GatewayDescription说明 LinksAlipay\_AopPageAlipay Page Gateway电脑网站支付 - new[Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-Page-Gateway) [Doc](https://doc.open.alipay.com/doc2/detail.htm?treeId=270&articleId=105901&docType=1)Alipay\_AopAppAlipay APP GatewayAPP支付 - new[Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-APP-Gateway) [Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=204&articleId=105051&docType=1)Alipay\_AopF2FAlipay Face To Face Gateway当面付 - new[Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-Face-To-Face-Gateway) [Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=194&articleId=105072&docType=1)Alipay\_AopWapAlipay WAP Gateway手机网站支付 - new[Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-WAP-Gateway) [Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=203&articleId=105288&docType=1)Alipay\_AopJsAlipay Js GatewayJSAPI - new[Usage](https://github.com/lokielse/omnipay-alipay/wiki/Aop-JS-Gateway) [Doc](https://myjsapi.alipay.com/jsapi/native/trade-pay.html)Alipay\_LegacyAppAlipay Legacy APP GatewayAPP支付[Usage](https://github.com/lokielse/omnipay-alipay/wiki/Legacy-APP-Gateway) [Doc](https://doc.open.alipay.com/doc2/detail?treeId=59&articleId=103563&docType=1)Alipay\_LegacyExpressAlipay Legacy Express Gateway即时到账[Usage](https://github.com/lokielse/omnipay-alipay/wiki/Legacy-Express-Gateway) [Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=108&articleId=103950&docType=1)Alipay\_LegacyWapAlipay Legacy WAP Gateway手机网站支付[Usage](https://github.com/lokielse/omnipay-alipay/wiki/Legacy-WAP-Gateway) [Doc](https://doc.open.alipay.com/docs/doc.htm?treeId=60&articleId=103564&docType=1)Usage
-----

[](#usage)

### Purchase (购买)

[](#purchase-购买)

```
/**
 * @var AopAppGateway $gateway
 */
$gateway = Omnipay::create('Alipay_AopPage');
$gateway->setSignType('RSA2'); // RSA/RSA2/MD5. Use certificate mode must set RSA2
$gateway->setAppId('the_app_id');
$gateway->setPrivateKey('the_app_private_key');
$gateway->setAlipayPublicKey('the_alipay_public_key'); // Need not set this when used certificate mode
$gateway->setReturnUrl('https://www.example.com/return');
$gateway->setNotifyUrl('https://www.example.com/notify');

// Must set cert path if you used certificate mode
//$gateway->setAlipayRootCert('the_alipay_root_cert'); // alipayRootCert.crt
//$gateway->setAlipayPublicCert('the_alipay_public_cert'); // alipayCertPublicKey_RSA2.crt
//$gateway->setAppCert('the_app_public_cert'); // appCertPublicKey.crt
//$gateway->setCheckAlipayPublicCert(true);

/**
 * @var AopTradePagePayResponse $response
 */
$response = $gateway->purchase()->setBizContent([
    'subject'      => 'test',
    'out_trade_no' => date('YmdHis') . mt_rand(1000, 9999),
    'total_amount' => '0.01',
    'product_code' => 'FAST_INSTANT_TRADE_PAY',
])->send();

$url = $response->getRedirectUrl();
```

For general usage instructions, please see the main [Omnipay](https://github.com/omnipay/omnipay)repository.

Related
-------

[](#related)

- [Laravel-Omnipay](https://github.com/ignited/laravel-omnipay)
- [Omnipay-GlobalAlipay](https://github.com/lokielse/omnipay-global-alipay)
- [Omnipay-WechatPay](https://github.com/lokielse/omnipay-wechatpay)
- [Omnipay-UnionPay](https://github.com/lokielse/omnipay-unionpay)

Support
-------

[](#support)

If you are having general issues with Omnipay, we suggest posting on [Stack Overflow](http://stackoverflow.com/). Be sure to add the [omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which you can subscribe to.

If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/php-cpm/omnipay-alipay/issues), or better yet, fork the library and submit a pull request.

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~25 days

Total

55

Last Release

2873d ago

Major Versions

v0.9.3 → v1.0.22013-07-23

v1.1.0 → v2.1.02013-12-08

v1.4.13 → v2.0.02016-09-24

v2.3.5 → v3.0.02018-01-04

PHP version history (2 changes)v0.8.0PHP &gt;=5.3.3

v0.8.4PHP &gt;=5.3.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff25f8f1ab71fb6f5f8ff1be6814227641f27de8c270eaa42160e669308c3407?d=identicon)[php-cpm](/maintainers/php-cpm)

![](https://www.gravatar.com/avatar/9e5a2dbec7206c65b826256396226bc2fa653c2281cd04797e767e50f63564a1?d=identicon)[nihaibao](/maintainers/nihaibao)

---

Top Contributors

[![amacneil](https://avatars.githubusercontent.com/u/637671?v=4)](https://github.com/amacneil "amacneil (207 commits)")[![lokielse](https://avatars.githubusercontent.com/u/1573211?v=4)](https://github.com/lokielse "lokielse (190 commits)")[![aderuwe](https://avatars.githubusercontent.com/u/1125184?v=4)](https://github.com/aderuwe "aderuwe (17 commits)")[![pilot](https://avatars.githubusercontent.com/u/28564?v=4)](https://github.com/pilot "pilot (11 commits)")[![php-cpm](https://avatars.githubusercontent.com/u/14024606?v=4)](https://github.com/php-cpm "php-cpm (4 commits)")[![TomasKit](https://avatars.githubusercontent.com/u/13846988?v=4)](https://github.com/TomasKit "TomasKit (3 commits)")[![winzou](https://avatars.githubusercontent.com/u/702928?v=4)](https://github.com/winzou "winzou (2 commits)")[![andywuzh](https://avatars.githubusercontent.com/u/173398?v=4)](https://github.com/andywuzh "andywuzh (2 commits)")[![asaph](https://avatars.githubusercontent.com/u/760071?v=4)](https://github.com/asaph "asaph (2 commits)")[![focus0802](https://avatars.githubusercontent.com/u/5154840?v=4)](https://github.com/focus0802 "focus0802 (2 commits)")[![johnkary](https://avatars.githubusercontent.com/u/135607?v=4)](https://github.com/johnkary "johnkary (2 commits)")[![michael2h4ng](https://avatars.githubusercontent.com/u/5486783?v=4)](https://github.com/michael2h4ng "michael2h4ng (2 commits)")[![rlerdorf](https://avatars.githubusercontent.com/u/54641?v=4)](https://github.com/rlerdorf "rlerdorf (2 commits)")[![shinvdu](https://avatars.githubusercontent.com/u/1124613?v=4)](https://github.com/shinvdu "shinvdu (2 commits)")[![skyred](https://avatars.githubusercontent.com/u/164034?v=4)](https://github.com/skyred "skyred (2 commits)")[![steveneaston](https://avatars.githubusercontent.com/u/242405?v=4)](https://github.com/steveneaston "steveneaston (2 commits)")[![michaeldoe](https://avatars.githubusercontent.com/u/1436773?v=4)](https://github.com/michaeldoe "michaeldoe (1 commits)")[![mtudor](https://avatars.githubusercontent.com/u/1683723?v=4)](https://github.com/mtudor "mtudor (1 commits)")[![nedmas](https://avatars.githubusercontent.com/u/842280?v=4)](https://github.com/nedmas "nedmas (1 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")

---

Tags

paymentgatewaypaymerchantomnipaypurchasealipay

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/php-cpm-omnipay-alipay/health.svg)

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

###  Alternatives

[lokielse/omnipay-alipay

Alipay gateway for Omnipay payment processing library

587421.0k11](/packages/lokielse-omnipay-alipay)[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)
