New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

sepayvn/laravel-sepay

Laravel Package cho SePay - Giải pháp tự động hóa cho thanh toán chuyển khoản ngân hàng
15,368 23

Larablocks Analysis

sepayvn/laravel-sepay works with Laravel 9 to 13 (latest release v1.2.3, May 3, 2026).

Recommendation checks

Solid choice

Solid choice: maintained and up to date, meets 2 of 4 checks; below the bar for Recommended on use.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (May 3, 2026)
  • 1,388 downloads a month (needs 10,000)
  • 23 GitHub stars (needs 100)

State

Maintained
  • Last stable release: May 3, 2026.
  • 1 release in the last 12 months.
  • First released: Nov 28, 2023.
  • Monthly downloads: 1,388.
  • 3 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.

Install
composer require sepayvn/laravel-sepay
Latest Version:v1.2.3
PHP:^8.0
Laravel:9 – 13
License:MIT
Last Updated:Oct 13, 2026
Links: GitHub  ·  Packagist
Maintainer: nguyentranchung

Laravel Package cho SePay - Giải pháp tự động hóa cho thanh toán chuyển khoản ngân hàng

Đăng ký tài khoản

Đăng ký tài khoản tại SePay!

Cài đặt

Bạn có thể cài đặt package qua composer:

composer require sepayvn/laravel-sepay

Phiên bản dành cho Laravel 7, 8 và PHP 7.4 trở lên

composer require "sepayvn/laravel-sepay:dev-lite"

Publish và chạy migrations:

php artisan vendor:publish --tag="sepay-migrations"
php artisan migrate

Publish file config:

php artisan vendor:publish --tag="sepay-config"

Nội dung của file config sau khi publish:

return [
    'webhook_token' => env('SEPAY_WEBHOOK_TOKEN'),
    'pattern' => env('SEPAY_MATCH_PATTERN', 'SE'),
];

Tùy chọn, bạn có thể publish views:

php artisan vendor:publish --tag="sepay-views"

Sử dụng

Tạo SePayWebhookListener

php artisan make:listener SePayWebhookListener
<?php

namespace App\Listeners;

use App\Models\User;
use SePay\SePay\Events\SePayWebhookEvent;
use SePay\SePay\Notifications\SePayTopUpSuccessNotification;

class SePayWebhookListener
{
    /**
     * Create the event listener.
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     */
    public function handle(SePayWebhookEvent $event): void
    {
        // Xử lý tiền vào tài khoản
        if ($event->sePayWebhookData->transferType === 'in') {
            // Trường hợp $info là user id
            $user = User::query()->where('id', $event->info)->first();
            if ($user instanceof User) {
                $user->notify(new SePayTopUpSuccessNotification($event->sePayWebhookData));
            }
        } else {
            // Xử lý tiền ra tài khoản
        }
    }
}
  • Đối với Laravel 11 trở xuống (7, 8, 9, 10)

    Đăng ký SePayWebhookListener vào app/Providers/EventServiceProvider.php

        protected $listen = [
            ...
            \SePay\SePay\Events\SePayWebhookEvent::class => [
                \App\Listeners\SePayWebhookListener::class,
            ],
        ];
    
  • Đối với phiên bản Laravel 11 trở lên, SePayWebhookListener đặt ở trong thư mục app/Listeners thì Laravel sẽ tự động gắn với SePayWebhookEvent bạn không cần phải đăng ký với Provider, tránh bị gọi 2 lần.

    Nếu bạn kiểm tra thấy SePayWebhookListener chưa lắng nghe SePayWebhookEvent thì bạn có thể làm như sau: vào phương thức boot trong app/Providers/AppServiceProvider.php

    public function boot(): void
    {
        \Illuminate\Support\Facades\Event::listen(
            \SePay\SePay\Events\SePayWebhookEvent::class,
            \App\Listeners\SePayWebhookListener::class,
        );
    }
    

Webhook

  1. Truy cập SePay Webhooks

  2. Bấm nút Thêm Webhook ở góc trên bên phải

  3. Các mục cần điền thì bạn hãy điền, riêng các mục sau cần lưu ý

    ![](https://raw.githubusercontent.com/sepayvn/laravel-sepay/HEAD/<images/Screenshot 2024-05-27 at 18.50.00.png>)

    1. thay domain.com thành tên miền của bạn
    2. Kiểu chứng thực: là Api Key
    3. API Key: nhập vào 1 dãy bí mật ngẫu nhiên gồm chữ và số (không có dấu như hình ví dụ nhé)
  4. Sửa file .env trong ứng dụng Laravel của bạn thành như sau

    ![](https://raw.githubusercontent.com/sepayvn/laravel-sepay/HEAD/<images/Screenshot 2024-05-27 at 19.33.19.png>)

    1. SEPAY_WEBHOOK_TOKEN - Là API Key nhập ở bước 3.3 ở trên
    2. SEPAY_MATCH_PATTERN - Mặc định là SE bạn có thể sửa cho phù hợp với ứng dụng của bạn

Kiểm tra với Postman

Bấm import trên postman và dán đoạn mã dưới đây vào

curl --location 'https://domain.com/api/sepay/webhook' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer Apikey đây_là_khóa_bí_mật' \
--data '{
    "gateway": "MBBank",
    "transactionDate": "2024-05-25 21:11:02",
    "accountNumber": "0359123456",
    "subAccount": null,
    "code": null,
    "content": "Thanh toan QR SE123456",
    "transferType": "out",
    "description": "Thanh toan QR SE123456",
    "transferAmount": 1700000,
    "referenceCode": "FT123456789",
    "accumulated": 0,
    "id": 123456
}'

Kiểm thử

composer test

Ủng hộ nhà phát triển

Bạn có thể hỗ trợ nhà phát triển gói này bằng cách sử dụng những dịch vụ sau:

Lịch sử thay đổi

Vui lòng xem CHANGELOG để biết thêm thông tin về các thay đổi gần đây.

Đóng góp

Vui lòng xem CONTRIBUTING để biết chi tiết.

Bảo mật

Vui lòng xem chính sách bảo mật để biết cách báo cáo lỗ hổng bảo mật.

Tác giả

Giấy phép

Giấy phép MIT. Vui lòng xem License File để biết thêm thông tin.

Related Packages

funnydevjsc/cryptomus-laravel-integrate

Laravel package for cryptomus.com

5,726 7
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607

Version History

Version Released PHP Laravel License
v1.2.3 ^8.0 ^9.28 | ^10.0 | ^11.0 | ^12.0 | ^13.0 MIT
v1.2.2 ^8.0 ^9.28 | ^10.0 | ^11.0 | ^12.0 MIT
v1.2.1 ^8.0 ^9.28 | ^10.0 | ^11.0 MIT
v1.2.0 ^8.0 ^9.28 | ^10.0 | ^11.0 MIT
v1.0.0 ^8.1 ^10.0 MIT