PHPackages                             yonghua4413/wxpay - 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. yonghua4413/wxpay

ActiveProject[Payment Processing](/categories/payments)

yonghua4413/wxpay
=================

微信支付 扫码支付 jspai支付

v0.0.3(8y ago)6853MITPHPPHP &gt;=5.4.0

Since Dec 5Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (4)Used By (0)

wxpay
=====

[](#wxpay)

微信支付 扫码支付 jspai支付

```
$ composer require yonghua4413/wxpay

```

```
//加载
use YYHwxpay\Wxpay;

//准备订单信息
$order_id = data('YmdHis').mt_rand(1000,9999);
$openid = ''; //自行获取用户openid
$ip = ''; //自行获取ip
$pay_param = array(
    'body' => '一分钱测试商品',
    'out_trade_no' => $order_id,
    'spbill_create_ip' => $ip,
    'total_fee' => 1,
    'notify_url' => '' //异步通知地址
);

//将订单提交到数据库（代码略）；

//自行申请
$config => array(
    'app_id'   => '',
    'app_secret'    => '',
    'app_mchid'=>'',
    'key' => ''
);

//调用统一下单
$weixin = new Wxpay($config);
$response = $weixin -> create_order($pay_param);

//发生错误
if($response['error'] == 1){
    var_dump($response['msg']);exit;
}

//扫码自付 获取支付二维码地址,自行调用相关类库生成二维码
$code_url = $response['data']['code_url'];
//扫码支付结束

//jspai支付 需要在config指定类型 'type' => "JSAPI"
$sign = $weixin -> get_jsbridge_param($response['data']['prepay_id']);

//页面端（jsapi支付）

$('#pay').on('click', function(){
	function onBridgeReady(){
	    WeixinJSBridge.invoke(
		'getBrandWCPayRequest', {
		    "appId":"",            //公众号名称，由商户传入
		    "timeStamp":"",    //时间戳，自1970年以来的秒数
		    "nonceStr":"",      //随机串
		    "package":"",
		    "signType":"",      //微信签名方式：
		    "paySign":""         //微信签名
		},
		function(res){
			  //使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。
		    if(res.err_msg == "get_brand_wcpay_request:ok" ) {
			  //自行支付成功后的跳转
			  }      
		}
	    );
	 }
	if (typeof WeixinJSBridge == "undefined"){
	    if( document.addEventListener ){
		document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
	    }else if (document.attachEvent){
		document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
		document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	    }
	 }else{
	    onBridgeReady();
	 }
});

```

```
#请选择最新的版本

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

3078d ago

### Community

Maintainers

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

---

Top Contributors

[![yonghua4413](https://avatars.githubusercontent.com/u/20510201?v=4)](https://github.com/yonghua4413 "yonghua4413 (11 commits)")

---

Tags

wechat-payjspai支付

### Embed Badge

![Health badge](/badges/yonghua4413-wxpay/health.svg)

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

###  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/coinbase

Coinbase driver for the Omnipay payment processing library

18558.8k1](/packages/omnipay-coinbase)

PHPackages © 2026

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