PHPackages                             kongflower/trade - 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. kongflower/trade

ActiveLibrary[Payment Processing](/categories/payments)

kongflower/trade
================

pay module

10PHP

Since Aug 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jiaoyugang/trade)[ Packagist](https://packagist.org/packages/kongflower/trade)[ RSS](/packages/kongflower-trade/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

\[TOC\]

微信支付
----

[](#微信支付)

##### APP支付

[](#app支付)

```
#APP支付
$app = new AppTrade([
    'appid' => 'wxb829xxxxxxxxf5',
    'mch_id' => '10xxxxx',
    'key' => '3phqOIxxxxxxx913ZpEskN',
]);

//统一下单
$result = $app->unified([
    'body' => '测试-充值测试',
    'notify_url' => 'https://pay.xxxxx.cn/pay_callback',
    'out_trade_no' => '20205122452',
    'total_fee' => 1,
]);
var_dump($result);

#查询订单状态：建议优先使用transaction_id，当然也可以使用out_trade_no（商户内部自定义的商品ID）
$result_query = $app->orquery([
    'transaction_id' => 'dy_13403007360239616',
]);
var_dump($result_query);
```

##### H5支付

[](#h5支付)

商户在微信客户端外的移动端网页展示商品或服务，用户在前述页面确认使用微信支付时，商户发起本服务呼起微信客户端进行支付。 主要用于触屏版的手机浏览器请求微信支付的场景。可以方便的从外部浏览器唤起微信支付。

```
// #H5支付
$h5 = new H5Trade([
    'appid' => 'wxb829xxxxxxxxf5',
    'mch_id' => '10xxxxx',
    'key' => '3phqOIxxxxxxx913ZpEskN',
]);

//统一下单
$result_h5 = $h5->unified([
        'body' => '测试-充值测试',
        'notify_url' => 'https://pay.xxxxx.cn/pay_callback',
        'out_trade_no' => '202051225779',
        'scene_info' => '{"h5_info": {"type":"IOS","app_name": "测试","bundle_id": "com.tencent.wzryIOS"}}',
        'total_fee' => 1 , //分
]);

var_dump($result_h5);

#查询订单状态：建议优先使用transaction_id，当然也可以使用out_trade_no（商户内部自定义的商品ID）
$result_query = $h5->orquery([
    'transaction_id' => 'dy_13403007360239616',
]);
var_dump($result_query);
```

##### JSAPI支付

[](#jsapi支付)

```
$jsapi = new JsapiTrade([
    'appid' => 'wxb829xxxxxxxxf5',
    'mch_id' => '10xxxxx',
    'key' => '3phqOIxxxxxxx913ZpEskN',
]);

$resultJsapi = $jsapi->unified([
    'body' => '测试-充值测试',
    'notify_url' => 'https://pay.skinrun.cn/pay_callback',
    'out_trade_no' => '202054541484',
    'total_fee' => 1,
    'openid' => 'oTrN9t1gi91ER6k98_Wv7E1W1jeA', //JSAPI支付必传参数
]);

var_dump($resultJsapi);
```

- NATIVE

> 模式一

> 模式二 商户后台系统将code\_url值生成二维码图片，用户使用微信客户端扫码后发起支付。code\_url有效期为2小时，过期后扫码不能再发起支付

```
array(10) {
  ["return_code"]=>
  string(7) "SUCCESS"
  ["return_msg"]=>
  string(2) "OK"
  ["appid"]=>
  string(18) "wxb829f31ecd32bdf5"
  ["mch_id"]=>
  string(8) "10037582"
  ["nonce_str"]=>
  string(16) "0TlM3wQrg32GAx0a"
  ["sign"]=>
  string(32) "4DB1D0F8FD4F343BB4E198C0F1835741"
  ["result_code"]=>
  string(7) "SUCCESS"
  ["prepay_id"]=>
  string(36) "wx21180541954546288e9eff191044490400"
  ["trade_type"]=>
  string(6) "NATIVE"
  ["code_url"]=>
  string(35) "weixin://wxpay/bizpayurl?pr=a97pITx"
}
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

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.

### Community

Maintainers

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

---

Top Contributors

[![jiaoyugang](https://avatars.githubusercontent.com/u/12998021?v=4)](https://github.com/jiaoyugang "jiaoyugang (19 commits)")

### Embed Badge

![Health badge](/badges/kongflower-trade/health.svg)

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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