PHPackages                             simplephp/payment - 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. simplephp/payment

ActiveLibrary[Payment Processing](/categories/payments)

simplephp/payment
=================

支付聚合 SDK PHP版本，支持微信、支付宝(包括商家/周期扣款)

v1.0.0(1y ago)2173MITPHPPHP &gt;=7.1.2

Since Nov 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/simplephp/payment)[ Packagist](https://packagist.org/packages/simplephp/payment)[ RSS](/packages/simplephp-payment/feed)WikiDiscussions main Synced 4w ago

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

介绍
--

[](#介绍)

---

payment 集成了原始支付宝支付SDK、微信支付SDK，封装了统一的支付接口，方便开发者快速集成支付功能，专注业务开发。

功能列表
----

[](#功能列表)

---

- 多商户号支持
- 支付宝支付
    - APP支付
    - 周期扣款
    - 商家扣款
    - 独立签约后扣款
    - 个人代扣协议查询
    - 周期性扣款协议执行计划修改
    - 个人代扣协议解约
    - web支付
    - 扫码支付
    - 交易查询
    - 交易撤销
    - 交易关闭
    - 退款申请
    - 退款查询
    - 申请交易账单
- 微信支付
    - APP支付
    - jsapi支付
    - wap支付
    - 扫码支付
    - 交易查询
    - 交易关闭
    - 退款申请
    - 退款查询
    - 申请交易账单
- 异步通知
- 更多功能持续更新中(如有急需功能，请提issues)...

环境依赖
----

[](#环境依赖)

---

- PHP &gt;= 7.1.2
- ext-json
- ext-openssl
- wechatpay/wechatpay: ^1.4.10
- simplephp/easyalipaysdk: ^2.2.7

安装
--

[](#安装)

---

1、通过命令行下安装：

```
composer require "simplephp/payment:1.0.*"
```

2、通过项目下composer.json文件配置方式安装：

```
"require": {
    "simplephp/payment": "1.0.*"
}
```

食用
--

[](#食用)

---

1、配置详解

```
$config = [
    'alipay' => [
        'default' => [
            // 支付宝-应用ID-必填
            'app_id' => '2021***408',
            // 支付宝-应用私钥-必填
            'merchant_private_key' => 'MIIE***m3I=',
            // 支付宝-支付宝公钥-选填（alipay_public_key【密钥模式】 和 （alipay_public_cert_path、alipay_root_cert_path、merchant_cert_path【证书模式】）二选一
            'alipay_public_key' => 'MIIB***AQAB',
            // 支付宝-支付宝公钥证书路径-选填
            'alipay_public_cert_path' => '',
            // 支付宝-支付宝根证书路径-选填
            'alipay_root_cert_path' => '',
            // 支付宝-应用公钥证书文件路径-选填
            'merchant_cert_path' => '',
            // 支付宝-同步通知地址-选填
            'return_url' => 'https://www.***.cn/alipay/return',
            // 支付宝-异步通知地址-选填
            'notify_url' => 'https://www.***.cn/alipay/notify',
            // 支付宝-周期扣款/商家扣款-选填 product_code：产品码 周期扣款：CYCLE_PAY_AUTH：商家扣款：GENERAL_WITHHOLDING
            'product_code' => Alipay::GENERAL_WITHHOLDING,
            // 支付宝-周期扣款/商家扣款-选填 sign_scene：签约场景码，具体参数请商家完成产品签约后，根据业务场景或用户购买商品的差异性对应新增模版及场景码。 说明：登录 商家平台 > 产品大全 > 商家扣款 > 功能管理 > 修改 > 设置模版 可新增模版及场景码。商家在确认新增模版及场景码完成后，签约接入时需要传入模版中实际填写的场景码。场景码格式详情可查看
            'sign_scene' => 'INDUSTRY|DEFAULT_SCENE',
            // 支付宝-周期扣款/商家扣款-选填 签约个人产品码
            'personal_product_code' => 'CYCLE_PAY_AUTH_P',
            //'mode' => Pay::MODE_NORMAL,
        ],
       // 其他商户配置 ....
    ],
    'wechat' => [
        'default' => [
            // 微信-商户号-必填
            'mch_id' => '151***131',
            // 微信-应用ID-必填
            'app_id' => 'wxd***2336',
            // 微信-v3商户秘钥-必填
            'api_v3_key' => 'RIGK***ZjZ3',
            // 微信-商户私钥文件地址-必填
            'merchant_private_key_path' => __DIR__ . '/cert/apiclient_key.pem',
            // 微信-商户API证书序列号-必填
            'merchant_certificate_serial' => '6645***D0744',
            // 微信-支付平台证书地址-必填，使用 composer 生成
            // composer exec CertificateDownloader.php -- -k ${apiV3key} -m ${mchId} -f ${mchPrivateKeyFilePath} -s ${mchSerialNo} -o ${outputFilePath}
            'platform_certificate_file_path' => __DIR__ . '/cert/wechatpay_61A5***F60C.pem',
            // 支付宝-同步通知地址-选填
            'return_url' => 'https://www.***.cn/alipay/return',
            // 支付宝-异步通知地址-选填
            'notify_url' => 'https://www.***.cn/alipay/notify',
            // 选填-默认为正常模式。可选为： MODE_NORMAL, MODE_SERVICE
            //'mode' => Pay::MODE_NORMAL,
        ]
    ],
];
```

2、集成示例 (示例详情请查看examples目录)

```
├── examples
│   ├── ....
│   ├── notify.php  // 异步通知示例
│   └── pay.php     // 支付示例
├── ...
```

说明
--

[](#说明)

---

- 大自然的搬运工,相关接口文档请查看官方文档
    - [微信支付文档](https://pay.weixin.qq.com/doc/v3/merchant/4012062524)
    - [支付宝支付文档](https://opendocs.alipay.com/open/00a0ut?pathHash=b19b288a)
- 有问题请提issues, 有能力的朋友请提交PR, 谢谢！

**本项目基于：**

- [wechatpay/wechatpay](https://github.com/wechatpay-apiv3/wechatpay-php)
- [alipay-easysdk](https://github.com/alipay/alipay-easysdk)

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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

607d ago

### Community

Maintainers

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

---

Top Contributors

[![simplephp](https://avatars.githubusercontent.com/u/5026959?v=4)](https://github.com/simplephp "simplephp (6 commits)")

### Embed Badge

![Health badge](/badges/simplephp-payment/health.svg)

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

PHPackages © 2026

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