PHPackages                             winwin/mbupay - 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. winwin/mbupay

ActiveProject[Payment Processing](/categories/payments)

winwin/mbupay
=============

311PHP

Since Aug 21Pushed 8y ago3 watchersCompare

[ Source](https://github.com/winwin-inc/mbupay-sdk)[ Packagist](https://packagist.org/packages/winwin/mbupay)[ RSS](/packages/winwin-mbupay/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

中信银行支付接口
========

[](#中信银行支付接口)

安装
--

[](#安装)

使用 [composer](http://getcomposer.org/):

```
$ composer require winwin/mbupay
```

配置
--

[](#配置)

调用接口需要先创建 payment 对象：

```
use winwin\mbupay\Config;
use winwin\mbupay\payment\Payment;

$payment = new Payment(new Config([
    'appid' => $appid,
    'secret' => $secret,
    'mch_id' => $merchant_id,
]));
```

创建订单
----

[](#创建订单)

```
use winwin\mbupay\payment\Order;

$result = $payment->prepare(new Order([
    'method' => 'mbupay.wxpay.jsapi',
    'body' => '支付1分',
    'total_fee' => 1,
    'out_trade_no' => date('ymdHis') . mt_rand(1000, 9999),
    'notify_url' => 'http://example.org/notify',
    'openid' => $openid,
]));
```

处理支付异步通知
--------

[](#处理支付异步通知)

```
$response = $payment->handleNotify(function($notify, $successful) {
    // 处理逻辑
    return true;
});
echo $response->getBody();
```

`handleNotify` 接收一个回调函数，该回调函数接收两个参数，这两个参数分别为：

- `$notify` 为封装了通知信息的数组对象，可以使用对象或者数组形式来读取通知内容，比如：`$notify->total_fee` 或者 `$notify['total_fee']`。
- `$successful` 用于判断用户是否付款成功了

回调函数返回 false 或者一个具体的错误消息，那么系统会在稍后再次继续通知你，直到你明确的告诉它：“我已经处理完成了”，在函数里 `return true;` 代表处理完成。

`handleNotify` 返回值 `$response` 是一个 [PSR-7](http://www.php-fig.org/psr/psr-7/) Response 对象。

调试
--

[](#调试)

如果需要打印 http 请求日志，可使用 [PSR-3](http://www.php-fig.org/psr/psr-3/) 实现库，例如 [Monolog](https://github.com/Seldaek/monolog) ：

```
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
$logger = new Logger('WinwinPay');
$logger->pushHandler(new StreamHandler('php://stderr', Logger::DEBUG));

$payment->setLogger($logger);
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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/28c8284abda0bddba804c7919864a36b925898741745ff910f98cd7f2fd73625?d=identicon)[wenbinye](/maintainers/wenbinye)

### Embed Badge

![Health badge](/badges/winwin-mbupay/health.svg)

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

PHPackages © 2026

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