PHPackages                             ouranoshong/wx-pay-api - 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. ouranoshong/wx-pay-api

ActiveLibrary[Payment Processing](/categories/payments)

ouranoshong/wx-pay-api
======================

WXPay library build on office sdk

v0.4.8(6y ago)0168MITPHPPHP &gt;=5.4

Since Jun 16Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ouranoshong/wx-pay-api)[ Packagist](https://packagist.org/packages/ouranoshong/wx-pay-api)[ RSS](/packages/ouranoshong-wx-pay-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (12)Used By (0)

WXPayAPI
========

[](#wxpayapi)

[![Build Status](https://camo.githubusercontent.com/5ed73508ae0b3f8fa044fc6a28463bbe56b282298e897ba2d49769eedc012e46/68747470733a2f2f7472617669732d63692e6f72672f6f7572616e6f73686f6e672f77782d7061792d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ouranoshong/wx-pay-api)

wxpay\_v3 api library

more detail see [wx office document](https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1)

Usage
-----

[](#usage)

#### Installation

[](#installation)

```
$ composer require ouranoshong/wx-pay-api
```

#### UnifiedOrderPay Api

[](#unifiedorderpay-api)

```
$client = new \WXPay\WXPayClient();

$config = new \WXPay\WXPayConfig();

$config->appId = '';
$config->mchId = '';
$config->key = '';
$config->notifyUrl = '';

$request = new \WXPay\Request\UnifiedOrderRequest();

$request->setBody('');
$request->setOutTradeNo('');
$request->setTotalFee();
$request->setSpBillCreateIp('');
$request->setOpenid('');

// or set other api parameter
$request->setXXX();

$response = new \WXPay\Response\UnifiedOrderResponse();

$client->setConfiguration($config);

$client->setHandlerName(\WXPay\Handler\UnifiedOrderHandler::class);

$client->handle($request, $response);

// print all response default
var_dump(json_encode($response->getResult(), JSON_PRETTY_PRINT));

// get specify reponse message (in camlcase)
$response->getXXX();
```

#### Notify Entity

[](#notify-entity)

```
// don't check signature
$notify = \WXPay\WXPayNotify::createFromXml('...');

// check signature
$notify = \WXPay\WXPayNotify::createFromXml('...', 'key');

// get signature from wei xin server push
$notify->sign;

// get something else
$nofiy->getXXX();
```

#### Reply Entity

[](#reply-entity)

```
// reply success message to wx server
echo \WXPay\WXPayReply::createSuccessReply();

// reply fail messge to wx server
echo \WXPay\WXPayReply::createFailReply('fail message');
```

### Functions

[](#functions)

```
// sign `$data` with `$key` use md5
\WXPay\signature($data, $key);

// generate nonce string
\WXPay\generate_nonce_str($len);

// convert asocc array to xml
\WXPay\convert_arr_to_xml($arr);

// convert xml to asocc array
\WXPay\convert_xml_to_arr($xml);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84% 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

Every ~83 days

Recently: every ~164 days

Total

11

Last Release

2418d ago

### Community

Maintainers

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

---

Top Contributors

[![ouranoshong](https://avatars.githubusercontent.com/u/5158627?v=4)](https://github.com/ouranoshong "ouranoshong (21 commits)")[![hong675](https://avatars.githubusercontent.com/u/18436295?v=4)](https://github.com/hong675 "hong675 (4 commits)")

---

Tags

sdkwx pay v3

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ouranoshong-wx-pay-api/health.svg)

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

###  Alternatives

[yandex-money/yandex-money-sdk-php

Yandex.Money API SDK for PHP

105167.4k2](/packages/yandex-money-yandex-money-sdk-php)[cryptonator/merchant-php-sdk

Cryptonator.com Merchant API SDK for PHP

2713.7k](/packages/cryptonator-merchant-php-sdk)[tatter/stripe

Stripe SDK integration for CodeIgniter 4

115.3k](/packages/tatter-stripe)

PHPackages © 2026

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