PHPackages                             hifreelight/union-pay - 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. hifreelight/union-pay

ActiveLibrary[Payment Processing](/categories/payments)

hifreelight/union-pay
=====================

The simplest union pay

v0.8.13(6y ago)013MITPHPPHP &gt;=5.6

Since May 9Pushed 6y agoCompare

[ Source](https://github.com/hifreelight/union-pay)[ Packagist](https://packagist.org/packages/hifreelight/union-pay)[ Docs](https://github.com/hifreelight/union-pay)[ RSS](/packages/hifreelight-union-pay/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (12)Versions (12)Used By (0)

UnionPay - 银联支付
===============

[](#unionpay---银联支付)

[![Latest Stable Version](https://camo.githubusercontent.com/849ea66347d9226ba99e938c72053b305a97d33259e2baf8bb511a51d7a34877/68747470733a2f2f706f7365722e707567782e6f72672f6869667265656c696768742f756e696f6e2d7061792f762f737461626c65)](https://packagist.org/packages/hifreelight/union-pay)[![License](https://camo.githubusercontent.com/f358f76739083949c50e252c7b13442eb8078092ffe24a719e3039add37fb1fd/68747470733a2f2f706f7365722e707567782e6f72672f6869667265656c696768742f756e696f6e2d7061792f6c6963656e7365)](https://packagist.org/packages/hifreelight/union-pay)[![Build Status](https://camo.githubusercontent.com/9f6fda0b489b6f6c3a61a50ff0c1d975a183b629e5c0b8f8e7d25e50a82f4070/68747470733a2f2f7472617669732d63692e6f72672f6869667265656c696768742f756e696f6e2d7061792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hifreelight/union-pay)[![codecov](https://camo.githubusercontent.com/45c49108db91552f97857da9b82f9cdba638647c56ceee7139d719974c7e06a4/68747470733a2f2f636f6465636f762e696f2f67682f6869667265656c696768742f756e696f6e2d7061792f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/hifreelight/union-pay)

simplest union pay - no dependency to any library, simple enough to let you hack.

### Feature

[](#feature)

- [B2C - Web网关支付](src/service/B2C.php)
- [Wap - WAP/手机网页网关支付](src/service/Wap.php)
- [App - App/控件支付](src/service/App.php)
- [B2B - 企业支付](src/service/B2B.php)
- [Direct - 无跳转标准版](src/service/Direct.php)
- [Token - 无跳转Token版](src/service/Token.php)
- [Qrcode - 二维码支付](src/service/Qrcode.php)
- [DirectDebit - 代收](src/service/DirectDebit.php)
- [Charge - 缴费产品](src/service/Charge.php)

### Install

[](#install)

```
composer require hifreelight/union-pay

```

or

add:

```
"hifreelight/union-pay":"0.8.12"

```

in composer.json

### Step 1: [config.php](demo/config.php) - 配置

[](#step-1-configphp---配置)

```
return ['test', [
		'version' => '5.1.0',
		'signMethod'=> '01', //RSA
		'encoding' => 'UTF-8',
		'merId' => '700000000000001',
		'returnUrl' => 'http://dev.git.com/union-pay/demo/payreturn.php', //前台网关支付返回
		'notifyUrl' => 'http://dev.git.com/union-pay/demo/paynotify.php', //后台通知
		'frontFailUrl'   => 'http://dev.git.com/union-pay/demo/payfail.php',
		'refundnotifyUrl' => 'http://dev.git.com.com/union-pay/demo/refundnotify.php',
		'signCertPath' => dirname(__FILE__).'/../cert/acp_test_sign.pfx',
		'signCertPwd' => '000000', //签名证书密码
		'verifyCertPath' => dirname(__FILE__).'/../cert/acp_test_verify_sign.cer',  //v5.0.0 required
		'verifyRootCertPath' => dirname(__FILE__).'/../cert/acp_test_root.cer', //v5.1.0 required
		'verifyMiddleCertPath' => dirname(__FILE__).'/../cert/acp_test_middle.cer', //v5.1.0 required
		'encryptCertPath' => dirname(__FILE__).'/../cert/acp_test_enc.cer',
		'ifValidateCNName' => false, //正式环境设置为true
	]
];
```

### Step 2: [pay.php](demo/b2c/pay.php) - 支付

[](#step-2-payphp---支付)

```
