Download the PHP package yuepay/yuepay-laravel without Composer

On this page you can find all versions of the php package yuepay/yuepay-laravel. 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 yuepay-laravel

粤收付(cnyepay)支付 SDK for Laravel

基于粤收付开放平台接口文档封装的 Laravel 支付 SDK,支持支付宝、微信等多种支付方式。

环境要求

安装

方式一:Composer(推荐)

方式二:手动引入

将本目录放置到 Laravel 项目的 packages/yuepay 下,然后在 composer.json 中添加:

执行:

配置

1. 发布配置文件

这会将配置文件发布到 config/yuepay.php。

2. 生成 RSA 密钥对

3. 配置 .env

4. 注册 ServiceProvider(手动安装时需要)

在 config/app.php 中添加:

5. 注册路由

在 routes/api.php 中添加:

使用方法

基本调用

依赖注入方式

处理回调通知

SDK 已内置回调处理控制器,路由为 POST /api/yuepay/notify。

回调处理逻辑在 YuePay\Http\Controllers\YuePayController::notify() 方法中,请根据业务需求修改。

关键步骤:

  1. 验签(SDK自动完成)
  2. 校验金额一致性
  3. 更新本地订单状态
  4. 返回 success

支付方式 wayCode 一览

wayCode 说明 必填参数
ALI_JSAPI 支付宝JSAPI(小程序) openid
ALI_QR 支付宝二维码 -
ALI_BAR 支付宝条码(付款码) authCode
ALI_WAP 支付宝H5 -
ALI_APP 支付宝APP -
WX_JSAPI 微信JSAPI(小程序) openid
WX_NATIVE 微信扫码 -
WX_BAR 微信条码(付款码) authCode
WX_H5 微信H5 -
WX_APP 微信APP -

目录结构

签名说明

SDK 使用 RSA2(SHA256withRSA)签名算法,流程如下:

  1. 将所有非空参数按参数名 ASCII 码字典序排序
  2. 拼接为 key1=value1&key2=value2... 格式(sign 不参与签名)
  3. 使用商户 RSA 私钥进行 SHA256withRSA 签名
  4. 签名结果转换为 Base64 编码

注意:与微信支付不同,粤收付 RSA2 签名时拼接字符串末尾不需要添加 API 密钥。

常见问题

Q: 签名失败?

Q: 验签失败?

Q: 回调收不到通知?

License

MIT


All versions of yuepay-laravel with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
ext-openssl Version *
illuminate/support Version ^6.0|^7.0|^8.0
illuminate/http Version ^6.0|^7.0|^8.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 yuepay/yuepay-laravel contains the following files

Loading the files please wait ...