PHPackages                             flyboyk/omnipay-alipay-hk - 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. flyboyk/omnipay-alipay-hk

ActiveLibrary[Payment Processing](/categories/payments)

flyboyk/omnipay-alipay-hk
=========================

Alipay Hk gateway for Omnipay payment processing library

1.0.0(6y ago)06MITPHP

Since Dec 8Pushed 6y ago1 watchersCompare

[ Source](https://github.com/flyBoyK/omnipay-alipay-hk)[ Packagist](https://packagist.org/packages/flyboyk/omnipay-alipay-hk)[ Docs](https://github.com/flyboyk/omnipay-alipay-hk)[ RSS](/packages/flyboyk-omnipay-alipay-hk/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Omnipay: AlipayHk
=================

[](#omnipay-alipayhk)

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

[![Build Status](https://camo.githubusercontent.com/8993e4f4fb13b5a562effdbd80251df3b2207506b04f894597d0fbc2b43753d8/68747470733a2f2f7472617669732d63692e6f72672f6c6f6b69656c73652f6f6d6e697061792d616c697061792d686b2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/lokielse/omnipay-alipay-hk)[![Latest Stable Version](https://camo.githubusercontent.com/f6d0b600f55ba8b44dda0b4700e19d9d9ef0773d711d83423c64029cc8e7c4f0/68747470733a2f2f706f7365722e707567782e6f72672f6c6f6b69656c73652f6f6d6e697061792d616c697061792d686b2f76657273696f6e2e706e67)](https://packagist.org/packages/lokielse/omnipay-alipay-hk)[![Total Downloads](https://camo.githubusercontent.com/d4ea92896a5dcacb7a6478c977caffe5e08281b0b66337d80c05616382f497b3/68747470733a2f2f706f7365722e707567782e6f72672f6c6f6b69656c73652f6f6d6e697061792d616c697061792d686b2f642f746f74616c2e706e67)](https://packagist.org/packages/lokielse/omnipay-alipay-hk)

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

> This package only support Alipay Hk service

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

[](#installation)

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

```
{
    "require": {
        "wjminions/omnipay-alipay-hk": "dev-master"
    }
}
```

And run composer to update your dependencies:

```
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

```

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

[](#basic-usage)

The following gateways are provided by this package:

- AlipayHk\_Web (Alipay Hk Web Gateway) 支付宝国际版Web支付宝接口
- AlipayHk\_Wap (Alipay Hk Wap Gateway) 支付宝国际版Wap支付宝接口
- AlipayHk\_App (Alipay Hk App Gateway) 支付宝国际版App支付宝接口

Usage
-----

[](#usage)

- Sandbox information: [SANDBOX.md](SANDBOX.md)
- Documentation: [AlipayHk Guid](https://ds.alipay.com/fd-ij9mtflt/home.html)

### Purchase

[](#purchase)

```
/**
 * @var Omnipay\AlipayHk\WebGateway $gateway
 */
//gateways: AlipayHk_Web, AlipayHk_Wap, AlipayHk_App
$gateway = Omnipay::create('AlipayHk_Web');
$gateway->setPartner('8888666622221111');
$gateway->setKey('your**key**here'); //for sign_type=MD5
$gateway->setPrivateKey($privateKeyPathOrData); //for sign_type=RSA
$gateway->setReturnUrl('http://www.example.com/return');
$gateway->setNotifyUrl('http://www.example.com/notify');
$gateway->setEnvironment('sandbox'); //for Sandbox Test (Web/Wap)

$params = [
    'out_trade_no' => date('YmdHis') . mt_rand(1000,9999), //your site trade no, unique
    'subject'      => 'test', //order title
    'total_fee'    => '0.01', //order total fee
    'currency'     => 'USD', //default is 'USD'
];

/**
 * @var Omnipay\AlipayHk\Message\WebPurchaseResponse $response
 */
$response = $gateway->purchase($params)->send();

//$response->redirect();
var_dump($response->getRedirectUrl());
var_dump($response->getRedirectData());
var_dump($response->getOrderString()); //for AlipayHk_App
```

### Return/Notify

[](#returnnotify)

```
/**
 * @var Omnipay\AlipayHk\WebGateway $gateway
 */
$gateway = Omnipay::create('AlipayHk_Web');
$gateway->setPartner('8888666622221111');
$gateway->setKey('your**key**here'); //for sign_type=MD5
$gateway->setPrivateKey($privateKeyPathOrData); //for sign_type=RSA
$gateway->setEnvironment('sandbox'); //for Sandbox Test (Web/Wap)

$params = [
    'request_params' => array_merge($_GET, $_POST), //Don't use $_REQUEST for may contain $_COOKIE
];

$response = $gateway->completePurchase($params)->send();

/**
 * @var Omnipay\AlipayHk\Message\CompletePurchaseResponse $response
 */
if ($response->isPaid()) {

   // Paid success, your statements go here.

   //For notify, response 'success' only please.
   //die('success');
} else {

   //For notify, response 'fail' only please.
   //die('fail');
}
```

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

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2348d ago

### Community

Maintainers

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

---

Top Contributors

[![pet1718php1](https://avatars.githubusercontent.com/u/50737697?v=4)](https://github.com/pet1718php1 "pet1718php1 (1 commits)")

---

Tags

paymentgatewaypaymerchantomnipayinternationalpurchasecross-borderalipay-hk

### Embed Badge

![Health badge](/badges/flyboyk-omnipay-alipay-hk/health.svg)

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

###  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)
