PHPackages                             phpviet/omnipay-vtcpay - 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. phpviet/omnipay-vtcpay

ActiveLibrary[Payment Processing](/categories/payments)

phpviet/omnipay-vtcpay
======================

Thư viện hổ trợ tích hợp cổng thanh toán VTCPay.

1.0.1(6y ago)29.9k↓50%12MITPHPPHP ^7.1

Since Jul 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/phpviet/omnipay-vtcpay)[ Packagist](https://packagist.org/packages/phpviet/omnipay-vtcpay)[ Docs](https://github.com/phpviet/omnipay-vtcpay)[ RSS](/packages/phpviet-omnipay-vtcpay/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (2)

 [ ![](https://raw.githubusercontent.com/phpviet/omnipay-vtcpay/master/resources/logo.png) ](https://vtcpay.vn)

Omnipay: VTCPay
===============

[](#omnipay-vtcpay)

 [![Latest version](https://camo.githubusercontent.com/042772020cb6635806786477744afd687d7e3fa3e964d1bb6ef32d88f810ebb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706870766965742f6f6d6e697061792d7674637061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phpviet/omnipay-vtcpay) [![Build status](https://camo.githubusercontent.com/dfa63a0623bcc4492ebc5328ffe21008aff4406f413632c02dc1d6904fef9e64/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f706870766965742f6f6d6e697061792d7674637061792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/phpviet/omnipay-vtcpay) [![Quantity score](https://camo.githubusercontent.com/b9c153a0d249fc11d90f4c9d811025cb276a6084a6fbce2a4b21f5f39675be0c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f706870766965742f6f6d6e697061792d7674637061792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/phpviet/omnipay-vtcpay) [![StyleCI](https://camo.githubusercontent.com/43cc017d1aa7b2c5798b743802714d3ef3ddfef07bcefb217514f7d62b6e76b6/68747470733a2f2f7374796c6563692e696f2f7265706f732f3138393035333833342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/189053834) [![Total download](https://camo.githubusercontent.com/88c1f4f915b972b15a5b0df03dbf9cf4a802d6f311c750793b8238430a3502d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706870766965742f6f6d6e697061792d7674637061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phpviet/omnipay-vtcpay) [![License](https://camo.githubusercontent.com/d49b66ec021e4093f0471c21f7e5003aff84e1598823fb1a07547cee985b076e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f706870766965742f6f6d6e697061792d7674637061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phpviet/omnipay-vtcpay)

Thông tin
---------

[](#thông-tin)

Thư viện hổ trợ tích cổng thanh toán VTCPay phát triển trên nền tảng [Omnipay League](https://github.com/thephpleague/omnipay).

Để nắm sơ lược về khái niệm và cách sử dụng các **Omnipay** gateways bạn hãy truy cập vào [đây](https://omnipay.thephpleague.com/)để kham khảo.

Cài đặt
-------

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

Cài đặt Omnipay VTCPay thông qua [Composer](https://getcomposer.org):

```
composer require phpviet/omnipay-vtcpay
```

Cách sử dụng
------------

[](#cách-sử-dụng)

### Tích hợp sẵn trên các framework phổ biến hiện tại

[](#tích-hợp-sẵn-trên-các-framework-phổ-biến-hiện-tại)

- [`Laravel`](https://github.com/phpviet/laravel-omnipay)
- [`Symfony`](https://github.com/phpviet/symfony-omnipay)
- [`Yii`](https://github.com/phpviet/yii-omnipay)

hoặc nếu bạn muốn sử dụng không dựa trên framework thì tiếp tục xem tiếp.

### Khởi tạo gateway:

[](#khởi-tạo-gateway)

```
use Omnipay\Omnipay;

$gateway = Omnipay::create('VTCPay');
$gateway->initialize([
    'website_id' => 'Do VTCPay cấp',
    'security_code' => 'Do VTCPay cấp',
]);
```

Gateway khởi tạo ở trên dùng để tạo các yêu cầu xử lý đến VTCPay hoặc dùng để nhận yêu cầu do VTCPay gửi đến.

### Tạo yêu cầu thanh toán:

[](#tạo-yêu-cầu-thanh-toán)

```
$response = $gateway->purchase([
    'receiver_account' => '0963465816',
    'reference_number' => microtime(false),
    'amount' => 50000,
    'url_return' => 'https://phpviet.org'
])->send();

if ($response->isRedirect()) {
    $redirectUrl = $response->getRedirectUrl();

    // TODO: chuyển khách sang trang VTCPay để thanh toán
}
```

Kham khảo thêm các tham trị khi tạo yêu cầu và VTCPay trả về tại [đây](https://vtcpay.vn/tai-lieu-tich-hop-website).

### Kiểm tra thông tin `url_return` khi khách được VTCPay redirect về:

[](#kiểm-tra-thông-tin-url_return-khi-khách-được-vtcpay-redirect-về)

```
$response = $gateway->completePurchase()->send();

if ($response->isSuccessful()) {
    // TODO: xử lý kết quả và hiển thị.
    print $response->amount;
    print $response->reference_number;

    var_dump($response->getData()); // toàn bộ data do VTCPay gửi sang.

} else {

    print $response->getMessage();
}
```

Kham khảo thêm các tham trị khi VTCPay trả về tại [đây](https://vtcpay.vn/tai-lieu-tich-hop-website).

### Kiểm tra thông tin `IPN` do VTCPay gửi sang:

[](#kiểm-tra-thông-tin-ipn-do-vtcpay-gửi-sang)

```
$response = $gateway->notification()->send();

if ($response->isSuccessful()) {
    // TODO: xử lý kết quả.
    print $response->amount;
    print $response->reference_number;

    var_dump($response->getData()); // toàn bộ data do VTCPay gửi sang.

} else {

    print $response->getMessage();
}
```

Kham khảo thêm các tham trị khi VTCPay gửi sang tại [đây](https://vtcpay.vn/tai-lieu-tich-hop-website).

Dành cho nhà phát triển
-----------------------

[](#dành-cho-nhà-phát-triển)

Nếu như bạn cảm thấy thư viện chúng tôi còn thiếu sót hoặc sai sót và bạn muốn đóng góp để phát triển chung, chúng tôi rất hoan nghênh! Hãy tạo các `issue` để đóng góp ý tưởng cho phiên bản kế tiếp hoặc tạo `PR`để đóng góp phần thiếu sót hoặc sai sót. Riêng đối với các lỗi liên quan đến bảo mật thì phiền bạn gửi email đến  thay vì tạo issue. Cảm ơn!

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~1 days

Total

2

Last Release

2500d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8901d64a1059726b851dbdd91463ad1d3169f9dba6a2dcff11d05f97d9bccaea?d=identicon)[vuongxuongminh](/maintainers/vuongxuongminh)

---

Top Contributors

[![vuongxuongminh](https://avatars.githubusercontent.com/u/38932626?v=4)](https://github.com/vuongxuongminh "vuongxuongminh (22 commits)")

---

Tags

active-merchantomnipayphpvietvtcpaypaymentpayment gatewayphpvietvietnam-paymentvietnam-payment-gatewayvtcpay

### Embed Badge

![Health badge](/badges/phpviet-omnipay-vtcpay/health.svg)

```
[![Health](https://phpackages.com/badges/phpviet-omnipay-vtcpay/health.svg)](https://phpackages.com/packages/phpviet-omnipay-vtcpay)
```

###  Alternatives

[phpviet/omnipay-momo

Thư viện hổ trợ tích hợp cổng thanh toán MoMo.

318.3k2](/packages/phpviet-omnipay-momo)[phpviet/omnipay-vnpay

Thư viện hổ trợ tích hợp cổng thanh toán VNPay.

178.2k2](/packages/phpviet-omnipay-vnpay)[shetabit/payment

Laravel Payment Gateway Integration Package

944330.1k5](/packages/shetabit-payment)[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[cybersource/rest-client-php

Client SDK for CyberSource REST APIs

39881.3k6](/packages/cybersource-rest-client-php)[tzsk/payu

PayU India Payment Gateway Integration with Laravel

47108.8k6](/packages/tzsk-payu)

PHPackages © 2026

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