Download the PHP package hyperbolaa/wechatpay without Composer

On this page you can find all versions of the php package hyperbolaa/wechatpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wechatpay

Wechatpay

微信支付,laravel, laravel5

安装

composer require hyperbolaa/wechatpay dev-master

laravel 配置

 'providers' => [
     // ...
     Hyperbolaa\Wechatpay\WechatpayServiceProvider::class,
 ]

生成配置文件

运行 `php artisan vendor:publish` 命令,
发布配置文件到你的项目中。

公众号支付

$wechatpay = app('wechatpay.jsapi');
$wechatpay->setBody('我是测试商品');
$wechatpay->setOutTradeNo(123456789);
$wechatpay->setTotalFee(1);
$wechatpay->setOpenid('ssssssss');//公众号openid获取参考微信网页授权

$result = $wechatpay->prepare();
if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){
    $prepayId = $result['prepay_id'];
    //WeixinJSBridge
    $json = $wechatpay->configForPayment($prepayId);
    $succ_url = 'xx';//支付成功回调地址
    $fail_url = 'xx';//支付失败回调地址
    $data = $wechatpay->bridgeHandle($json,$succ_url,$fail_url);
    return new Response($data);
}else{
    $msg = '微信回调失败;请求错误信息:'.$result['return_msg'].';业务错误信息:'.$result['err_code_des'];
    return new Response($msg);
}

小程序支付

$wechatpay = app('wechatpay.xcx');
$wechatpay->setBody('我是测试商品');
$wechatpay->setOutTradeNo(123456789);
$wechatpay->setTotalFee(1);
$wechatpay->setOpenid('ssssssss');//微信小程序的openid获取参考wx.login

$result = $wechatpay->prepare();
if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){
    $prepayId = $result['prepay_id'];
    $data = $wechatpay->configForPayment($prepayId,false);
    return new Response($data);//返回给微信小程序
}else{
    $msg =  '微信回调失败;请求错误信息:'.$result['return_msg'].';业务错误信息:'.$result['err_code_des'];
    return new Response($msg);
}

小程序登录获取用户信息拓展

app('wechatpay.xcx')->getUserInfo($encrypteddata,$iv,$sessionkey);

APP支付

$wechatpay = app('wechatpay.app');
$wechatpay->setBody('我是测试商品');
$wechatpay->setOutTradeNo(123456789);
$wechatpay->setTotalFee(1);

$result = $wechatpay->prepare();
if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){
    $prepayId = $result['prepay_id'];
    return $wechatpay->configForPayment($prepayId);
}else{
    return '微信回调失败;请求错误信息:'.$result['return_msg'].';业务错误信息:'.$result['err_code_des'];
}

异步通知

public function wechatpayNotify()
{
    // 判断通知类型。
    $response = app('wechatpay.jsapi')->handleNotify(function ($notify, $successful) {
        $out_trade_no   = $notify->out_trade_no;//商户订单号
        $transaction_id = $notify->transaction_id;//微信订单号
        //
        if($successful){
            //todo 处理支付成功,,,
        }
        return true;
    });

    return new Response($response);
}

货币单位

支付类别

JSAPI     [公众号,小程序]支付    已接通
APP       APP支付              已接通
NATIVE    扫码支付      
MICROPAY  刷卡支付

已优化

回复数据格式化处理,支持json,arr 
添加日志记录

联系&打赏

如果真心觉得项目帮助到你,为你节省了成本,欢迎鼓励一下。

如果有什么问题,可通过以下方式联系我。提供有偿技术服务。

也希望更多朋友可用提供代码支持。欢迎交流与打赏。

加入QQ群:60973229

Related


All versions of wechatpay with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
illuminate/support Version 5.*
illuminate/events Version 5.*
illuminate/config Version 5.*
guzzlehttp/guzzle Version ~6.0
symfony/http-foundation Version ~2.1|~3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hyperbolaa/wechatpay contains the following files

Loading the files please wait ....