PHPackages                             hyperbolaa/unionpay - 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. hyperbolaa/unionpay

ActiveProject[Payment Processing](/categories/payments)

hyperbolaa/unionpay
===================

银联支付SDK在Laravel5中封装包。

v1.0(9y ago)255188MITPHPPHP &gt;=5.5.0

Since Apr 1Pushed 6y ago1 watchersCompare

[ Source](https://github.com/hyperbolaa/Unionpay)[ Packagist](https://packagist.org/packages/hyperbolaa/unionpay)[ Docs](https://github.com/hyperbolaa/Unionpay)[ RSS](/packages/hyperbolaa-unionpay/feed)WikiDiscussions master Synced yesterday

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

Unionpay &amp; laravel &amp; 银联支付
---------------------------------

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

#### 交易类型

[](#交易类型)

- 00：查询交易，
- 01：消费，
- 02：预授权，
- 03：预授权完成，
- 04：退货，
- 05：圈存，
- 11：代收，
- 12：代付，
- 13：账单支付，
- 14：转账（保留），
- 21：批量交易，
- 22：批量查询，
- 31：消费撤销，
- 32：预授权撤销，
- 33：预授权完成撤销，
- 71：余额查询，
- 72：实名认证-建立绑定关系，
- 73：账单查询，
- 74：解除绑定关系，
- 75：查询绑定关系，
- 77：发送短信验证码交易，
- 78：开通查询交易，
- 79：开通交易，
- 94：IC卡脚本通知 ,
- 95：查询更新加密公钥证书

#### 产品类型:bizType

[](#产品类型biztype)

- 依据实际业务场景填写 默认取值：000000 具体取值范围：
- 000201：B2C 网关支付
- 000301：认证支付 2.0
- 000302：评级支付
- 000401：代付
- 000501：代收
- 000601：账单支付
- 000801：跨行收单
- 000901：绑定支付
- 001001：订购
- 000202：B2B

#### 接入类型：accessType

[](#接入类型accesstype)

- 0：商户直接接入
- 1：收单机构接入
- 2：平台商接入

#### 渠道类型：channelType

[](#渠道类型channeltype)

- 05：语音
- 07：互联网
- 08：移动
- 16：数字机顶盒

#### 应答码：respCode

[](#应答码respcode)

- 00：成功
- 01-09：银联全渠道系统原因导致的错误
- 10-29：商户端上送保温格式检查导致的错误
- 30-59：商户端相关业务检查导致的错误
- 60-89：持卡人/发卡行 相关问题导致的错误
- 90-99：预留

#### 备注

[](#备注)

```
version5.0.0 与 version5.1.0 验签方式不一样
本项目使用的是version5.0.0   (使用其他版本会存在问题)

```

#### 安装

[](#安装)

```
composer require hyperbolaa/unionpay dev-master

```

#### laravel 配置

[](#laravel-配置)

```
 'providers' => [
     // ...
     Hyperbolaa\Unionpay\UnionpayServiceProvider::class,
 ]

```

#### 生成配置文件

[](#生成配置文件)

```
运行 `php artisan vendor:publish` 命令，
发布配置文件到你的项目中。

```

#### app代码使用

[](#app代码使用)

```
$unionpay = app('unionpay.mobile');
$unionpay->setOrderId('order_id');
$unionpay->setTxnAmt('order_amount');
$unionpay->setTxnTime('req_time');

//返回签名后的支付参数给移动端的sdk-》{539512046523081531300}
return $unionpay->consume();

```

#### wap代码使用

[](#wap代码使用)

```
$unionpay = app('unionpay.wap');
$unionpay->setOrderId('order_id');
$unionpay->setTxnAmt('order_amount');
$unionpay->setTxnTime('req_time');

//返回一个表单
return $unionpay->consume();

```

#### 异步通知

[](#异步通知)

```
	public function unionpayNotify()
	{
		if (! app('unionpay.mobile')->verify()) {
			Log::notice('unionpay notify post data verification fail.', [
				'data' => Request::instance()->getContent()
			]);
			return 'fail';
		}

		// 判断通知类型。
		if (Input::get('respCode') == '00') {
				// TODO: 支付成功，取得订单号进行其它相关操作。
				Log::debug('unionpay notify get data verification success.', [
					'out_trade_no'  => Input::get('orderId'),
					'trade_no'      => Input::get('queryId')
				]);
		}

		return 'success';
	}

```

稳定版本使用
------

[](#稳定版本使用)

```
composer require hyperbolaa/unionpay:1.0

```

happy coding
------------

[](#happy-coding)

联系&amp;打赏
---------

[](#联系打赏)

如果真心觉得项目帮助到你，为你节省了成本，欢迎鼓励一下。

如果有什么问题，可通过以下方式联系我。提供有偿技术服务。

也希望更多朋友可用提供代码支持。欢迎交流与打赏。

**加入QQ群**：60973229

Related
-------

[](#related)

- [Ylpay](https://github.com/hyperbolaa/Ylpay) 基于laravel5的POS通支付
- [Alipay](https://github.com/hyperbolaa/Alipay) 基于laravel5的支付宝支付
- [Wechatpay](https://github.com/hyperbolaa/Wechatpay) 基于laravel5的微信支付
- [Alisms](https://github.com/hyperbolaa/Alisms) 基于laravel5的阿里云短信

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

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

3377d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10859667?v=4)[Hyperbolaa](/maintainers/hyperbolaa)[@hyperbolaa](https://github.com/hyperbolaa)

---

Top Contributors

[![hyperbolaa](https://avatars.githubusercontent.com/u/10859667?v=4)](https://github.com/hyperbolaa "hyperbolaa (31 commits)")

---

Tags

laravel5unionunionpaylaravel5.2

### Embed Badge

![Health badge](/badges/hyperbolaa-unionpay/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M123](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9772.3M122](/packages/roots-acorn)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2022.1M6](/packages/laravel-notification-channels-apn)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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