定制 nhanchaukp/alepay 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nhanchaukp/alepay

最新稳定版本:1.0.3

Composer 安装命令:

composer require nhanchaukp/alepay

包简介

Tích hợp thanh toán Alepay cho Laravel

README 文档

README

Hướng dẫn cài đặt

Cài đặt package

composer require nhanchaukp/alepay

Publish file cấu hình tài khoản

php artisan vendor:publish --tag=alepay-config

Thay đổi các giá trị liên quan đến tài khoản kết nối với Alepay ở file: config/alepay

Hiển thị trang demo

Thêm vào routes web.php

use Nhanchaukp\Alepay\Facades\Alepay;
...

Alepay::routes();

Truy cập demo tại domain.com/demo-alepay.

Các phương thức

Tạo yêu cầu và lấy link thanh toán

use Nhanchaukp\Alepay\Facades\Alepay;
...

$orderInfo = [
    'amount' => 100000,
    'orderCode' => 'FCODE123',
    'currency' => 'VND',
    'orderDescription' => 'Test thanh toán Alepay',
    'totalItem' => 1,
    'checkoutType' => 3,
    'allowDomestic' => true,

    'buyerName' => 'Nhan Chau KP',
    'buyerEmail' => 'demoalepay@gmail.com',
    'buyerPhone' => '0929389359',
    'buyerAddress' => 'Vung liem',
    'buyerCity' => 'Vinh Long',
    'buyerCountry' => 'Viet Nam',

];

$result = Alepay::requestPayment($orderInfo);

Lấy thông tin giao dịch

use Nhanchaukp\Alepay\Facades\Alepay;
...

public function alepayResult(Request $request)
{
    if ($request->errorCode == '000') {
        // success
        $info = Alepay::getTransactionInfo($request->transactionCode);
        dd($info);
    } else {
        // error
    }
}

Xác thực dữ liệu webhook

use Nhanchaukp\Alepay\Facades\Alepay;
...

public function webhook(Request $request)
{
    return response()->json([
        'raw' => $request->all(),
        'verify' => Alepay::verifyTransaction($request->all())
    ]);
}

统计信息

  • 总下载量: 1.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-21