PHPackages                             tringuyenduc2903/vnpayvietnam-laravel - 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. tringuyenduc2903/vnpayvietnam-laravel

ActiveLibrary[Payment Processing](/categories/payments)

tringuyenduc2903/vnpayvietnam-laravel
=====================================

VNPay SDK for Laravel framework (Only Vietnam Support)

v2.0.0(8mo ago)09[2 PRs](https://github.com/tringuyenduc2903/VNPayVietNam-Laravel/pulls)MITPHPPHP ^8.3CI passing

Since Aug 29Pushed 1mo agoCompare

[ Source](https://github.com/tringuyenduc2903/VNPayVietNam-Laravel)[ Packagist](https://packagist.org/packages/tringuyenduc2903/vnpayvietnam-laravel)[ Docs](https://github.com/tringuyenduc2903/vnpayvietnam-laravel)[ GitHub Sponsors]()[ RSS](/packages/tringuyenduc2903-vnpayvietnam-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (15)Versions (6)Used By (0)

VNPay SDK for Laravel framework (Only Vietnam Support)
======================================================

[](#vnpay-sdk-for-laravel-framework-only-vietnam-support)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e0e399b3dd2e1a2d32f15b887f871d74249861fb7d24fcc06d0caceca7d4bbfd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7472696e677579656e647563323930332f766e706179766965746e616d2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tringuyenduc2903/vnpayvietnam-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/e90e35acd6ca6f0aa3e1f0b8a2f69773ca4946c694e789e94aa7077f24a62e73/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7472696e677579656e647563323930332f766e706179766965746e616d2d6c61726176656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/tringuyenduc2903/vnpayvietnam-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/a4b08fd3500a6789b6dd619e4c6dffb4dc0a680ef46f79a4570137d998b77e06/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7472696e677579656e647563323930332f766e706179766965746e616d2d6c61726176656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/tringuyenduc2903/vnpayvietnam-laravel/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/3feaa19e218c3ed0a1be7efd55c711e1b4333d2e2928b7606dd8dd71a3ecdafd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7472696e677579656e647563323930332f766e706179766965746e616d2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tringuyenduc2903/vnpayvietnam-laravel)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require tringuyenduc2903/vnpayvietnam-laravel
```

You can publish the config file with:

```
php artisan vendor:publish --tag="vnpayvietnam-config"
```

This is the contents of the published config file:

```
return [
    'url' => env('VNPAY_API_URL', 'https://sandbox.vnpayment.vn'),
    'tmn_code' => env('VNPAY_TMN_CODE', ''),
    'hash_secret' => env('VNPAY_HASH_SECRET', ''),
];
```

#### Giải thích

[](#giải-thích)

- **url**: Môi trường phát triển tích hợp (**Sandbox**: )
- **tmn\_code**: Terminal ID / Mã Website
- **hash\_secret**: Secret Key / Chuỗi bí mật tạo checksum

#### File .env:

[](#file-env)

```
VNPAY_API_URL=https://sandbox.vnpayment.vn
VNPAY_TMN_CODE=
VNPAY_HASH_SECRET=
```

Usage
-----

[](#usage)

### [Tạo URL Thanh toán](https://sandbox.vnpayment.vn/apis/docs/thanh-toan-pay/pay.html#tao-url-thanh-toan)

[](#tạo-url-thanh-toán)

```
use BeetechAsia\VNPay\Enums\OrderType;use BeetechAsia\VNPay\Facades\VNPay;

$data = [
    'vnp_Amount' => 843_035,
    'vnp_IpAddr' => '10.100.0.1',
    'vnp_OrderInfo' => 'Description',
    'vnp_OrderType' => OrderType::FOOD_CONSUMPTION,
    'vnp_ReturnUrl' => 'https://example.com/return',
    'vnp_ExpireDate' => now('Asia/Ho_Chi_Minh')->addMinutes(10)->format('YmdHis'),
    'vnp_TxnRef' => 'b663e2c8-ed95-34bb-b7e7-355c7121d3a8',
];
VNPay::createPaymentUrl($data);
```

### Danh sách Ngân hàng (vnp\_BankCode)

[](#danh-sách-ngân-hàng-vnp_bankcode)

```
use BeetechAsia\VNPay\Facades\VNPay;

VNPay::getBankCodes();
```

### [Cài đặt Code IPN URL](https://sandbox.vnpayment.vn/apis/docs/thanh-toan-pay/pay.html#code-ipn-url)

[](#cài-đặt-code-ipn-url)

```
use BeetechAsia\VNPay\Facades\VNPay;

$order_id = '9d8849ec-ed01-3324-83d1-85b61484412f'; // Mã tham chiếu của giao dịch tại hệ thống
$order_amount = 843_035; // Số tiền thanh toán
$check_updated_order_callback = fn(): bool => false // Closure kiểm tra trạng thái xác nhận giao dịch tại hệ thống
$update_order_callback = function () { } // Closure thực hiện cập nhật trạng thái xác nhận giao dịch tại hệ thống
$handle = VNPay::handleIpn(
    $order_id,
    $order_amount,
    $check_updated_order_callback,
    $update_order_callback,
);
```

### [Truy vấn kết quả thanh toán](https://sandbox.vnpayment.vn/apis/docs/truy-van-hoan-tien/querydr&refund.html#truy-van-ket-qua-thanh-toan-PAY)

[](#truy-vấn-kết-quả-thanh-toán)

```
use BeetechAsia\VNPay\Facades\VNPay;

$data = [
    'vnp_RequestId' => 1,
    'vnp_TxnRef' => 'b663e2c8-ed95-34bb-b7e7-355c7121d3a8',
    'vnp_OrderInfo' => 'Description',
    'vnp_TransactionDate' => '20250828132325',
    'vnp_IpAddr' => '10.100.0.1',
];
VNPay::getPaymentResult($data);
```

### [Giao dịch hoàn tiền](https://sandbox.vnpayment.vn/apis/docs/truy-van-hoan-tien/querydr&refund.html#hoan-tien-thanh-toan-PAY)

[](#giao-dịch-hoàn-tiền)

```
use BeetechAsia\VNPay\Facades\VNPay;
use BeetechAsia\VNPay\Enums\RefundTransactionType;

$data = [
    'vnp_RequestId' => 1,
    'vnp_TransactionType' => RefundTransactionType::FULL,
    'vnp_TxnRef' => 'b663e2c8-ed95-34bb-b7e7-355c7121d3a8',
    'vnp_Amount' => 843_035,
    'vnp_OrderInfo' => 'Description',
    'vnp_TransactionDate' => '20250828132325',
    'vnp_CreateBy' => 'NGUYEN VAN A',
    'vnp_IpAddr' => '10.100.0.1',
];
VNPay::sendRefundRequest($data);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](https://github.com/tringuyenduc2903/VNPayVietNam-Laravel/security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Tri Nguyen Duc (Bee Tech - PHP)](https://github.com/tringuyenduc2903)
- [All Contributors](https://github.com/tringuyenduc2903/VNPayVietNam-Laravel/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance78

Regular maintenance activity

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

2

Last Release

256d ago

Major Versions

v1.0.0 → v2.0.02025-08-29

### Community

Maintainers

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

---

Top Contributors

[![tringuyenbtjsc](https://avatars.githubusercontent.com/u/199541547?v=4)](https://github.com/tringuyenbtjsc "tringuyenbtjsc (10 commits)")[![tringuyenduc2903](https://avatars.githubusercontent.com/u/101564593?v=4)](https://github.com/tringuyenduc2903 "tringuyenduc2903 (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelBeetech Asiavnpayvietnam-laravel

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/tringuyenduc2903-vnpayvietnam-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/tringuyenduc2903-vnpayvietnam-laravel/health.svg)](https://phpackages.com/packages/tringuyenduc2903-vnpayvietnam-laravel)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

7812.3k](/packages/danestves-laravel-polar)[spatie/laravel-mailcoach-sdk

An SDK to easily work with the Mailcoach API in Laravel apps

41290.2k1](/packages/spatie-laravel-mailcoach-sdk)

PHPackages © 2026

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