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

ActiveLibrary

delz/pay
========

支付网关组件

1741PHP

Since Mar 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/sheawey/DelzPay)[ Packagist](https://packagist.org/packages/delz/pay)[ RSS](/packages/delz-pay/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

支付组件
====

[](#支付组件)

参考Omnipay实现。

目前支持的有：

(1) 微信支付

包括公众号支付、小程序支付、App支付、扫码付等。

举例说明
----

[](#举例说明)

以微信支付说明：

```
/**
  * 利用composer的自动加载
  *
  * @var \Composer\Autoload\ClassLoader $loader
  */
$loader = require __DIR__ . "/../vendor/autoload.php";

/**
 * @var JsGateway $weChatPay
 */
$weChatPay = PayGatewayFactory::create('WeChat_Js');
$weChatPay->setAppId('appId');
$weChatPay->setMchId('mchId');
$weChatPay->setApiKey('apikey');

//发起支付请求
$request = $weChatPay->purchase($parameters);
$response = $request->send();
if ($response->isSuccessful()) {
    //获取返回数据
    $result = $response->getData();
    return $result;
}

//异步回调
$request = $weChatPay->notify();
$response = $request->send();

//如果支付成功
if ($response->isPaid()) {
     //获取支付成功返回参数
    $data = $response->getData();

    //这里处理支付成功的逻辑

    //向微信报告支付成功
    echo $response->getSuccessResult();
} else {
    //向微信报告支付失败
    echo $response->getFailResult('FAIL');
}

//退款

$weChatPay->setCertPath(__DIR__ . '/../resource/cert/wxpay/apiclient_cert.pem');
$weChatPay->setKeyPath(__DIR__ . '/../resource/cert/wxpay/apiclient_key.pem');
$parameters = [
    'out_trade_no' => '123456',
    'out_refund_no' => '654321',
    'total_fee' => 100,
    'refund_fee' => 100,
     //'refund_account' => 'REFUND_SOURCE_RECHARGE_FUNDS',//如果要从余额退款，请去掉注释
];
$request = $weChatPay->refund($parameters);
$response = $request->send();
if ($response->isSuccessful()) {
    //这里处理退款请求提交成功的逻辑
}

//退款结果查询

$parameters = [
    'out_refund_no' => '123456',
];
$request = $weChatPay->queryRefund($parameters);
$response = $request->send();
if ($response->isSuccessful()) {
    //这里处理退款成功的逻辑
}

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![sheawey87](https://avatars.githubusercontent.com/u/212719452?v=4)](https://github.com/sheawey87 "sheawey87 (25 commits)")

### Embed Badge

![Health badge](/badges/delz-pay/health.svg)

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

PHPackages © 2026

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