PHPackages                             dgvai/laravel-nagad - 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. dgvai/laravel-nagad

ActiveLibrary[Payment Processing](/categories/payments)

dgvai/laravel-nagad
===================

Nagad Payment Gateway for Laravel (Bangladesh)

1.0.1(5y ago)101.7k3[1 issues](https://github.com/dgvai/laravel-nagad/issues)MITPHP

Since Sep 23Pushed 5y ago2 watchersCompare

[ Source](https://github.com/dgvai/laravel-nagad)[ Packagist](https://packagist.org/packages/dgvai/laravel-nagad)[ RSS](/packages/dgvai-laravel-nagad/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Nagad (Bangladesh) payment gateway for Laravel 6.x+
===================================================

[](#nagad-bangladesh-payment-gateway-for-laravel-6x)

[![Latest Stable Version](https://camo.githubusercontent.com/78446929c4720b1f6e40eb29b1d77b085e475dc5fa4a20292123bc8a82b42808/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d6e616761642f762f737461626c65)](https://packagist.org/packages/dgvai/laravel-nagad)[![Total Downloads](https://camo.githubusercontent.com/d2faee06e54502b464a2695a2e53d804352627fd57ac93b8e96b05fffa86a1ae/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d6e616761642f646f776e6c6f616473)](https://packagist.org/packages/dgvai/laravel-nagad)[![Latest Unstable Version](https://camo.githubusercontent.com/1923af02ffc9682dda54b72a757c66c6dd159b5c83871d6dfaceee1f3aff4867/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d6e616761642f762f756e737461626c65)](https://packagist.org/packages/dgvai/laravel-nagad)[![License](https://camo.githubusercontent.com/b03befdc64ad1ac3a668a7c7bc1c27846923ca05ae89aea9f9388ab685bdb4cb/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d6e616761642f6c6963656e7365)](https://packagist.org/packages/dgvai/laravel-nagad)[![Monthly Downloads](https://camo.githubusercontent.com/3cf68e0c4e39d6c8e218bcb29831e511501efa952705c0ee6695cc8cd9a571a5/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d6e616761642f642f6d6f6e74686c79)](https://packagist.org/packages/dgvai/laravel-nagad)[![Daily Downloads](https://camo.githubusercontent.com/a1fa7a51937f8778d9c100a501c95c430ba226dec3a5cadbe4d0b0e189f3a2f9/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d6e616761642f642f6461696c79)](https://packagist.org/packages/dgvai/laravel-nagad)[![composer.lock](https://camo.githubusercontent.com/d2d0ce55bb61b68eb3a23be8b4f52c194a2b39e0c3e82bf44c8592ad51c8180e/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d6e616761642f636f6d706f7365726c6f636b)](https://packagist.org/packages/dgvai/laravel-nagad)

[Nagad](https://nagad.com.bd) is one of the Financial Services in Bangladesh. This package is built for Nagad Payment Gateway for Laravel 6.x, 7.x and 8.x+

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up your configuration](#setting-up-your-configuration)
- [Usage](#usage)
- [Changelog](#changelog)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require dgvai/laravel-nagad
```

### Setting up your configuration

[](#setting-up-your-configuration)

Extract the nagad config files:

```
php artisan vendor:publish --tag=nagad-config
```

- This will publish and config file in `config_path()` of your application. Eg. `config/nagad.php`
- Configure the configurations for the nagad merchant acocunt. Use `sandbox = true` for development stage.
- Be sure to set the **timezone** of you application to `Asia/Dhaka` in order to work with Nagad PG. To do this: go to `config/app.php` and set `'timezone' => 'Asia/Dhaka'`

Usage
-----

[](#usage)

NagadPG uses three stages of payment process, and two of theme are simultaneous. To get started, first you have to setup a callback route (`GET`) for the Nagad Callback and name the route in the nagad config file.

```
    // in routes/web.php
    Route::get('/nagad/callback', 'NagadController@callback')->name('nagad.callback');

    //in config/nagad.php
    'callback' => 'nagad.callback' // or use env variable to store
```

To Start payment, in your controller:

```
    // in SomeController.php
    use DGvai\Nagad\Facades\Nagad;

    public function createPayement()
    {
        /**
         * Method 1: Quickest
         * This will automatically redirect you to the Nagad PG Page
         * */

        return Nagad::setOrderID('ORDERID123')
            ->setAmount('540')
            ->checkout()
            ->redirect();

        /**
         * Method 2: Manual Redirection
         * This will return only the redirect URL and manually redirect to the url
         * */

        $url = Nagad::setOrderID('ORDERID123')
            ->setAmount('540')
            ->checkout()
            ->getRedirectUrl();

        return ['url' => $url];

        /**
         * Method 3: Advanced
         * You set additional params which will be return at the callback
         * */

        return Nagad::setOrderID('ORDERID123')
            ->setAmount('540')
            ->setAddionalInfo(['pid' => 9, 'myName' => 'DG'])
            ->checkout()
            ->redirect();

        /**
         * Method 4: Advanced Custom Callabck
         * You can set/override callback url while creating payment
         * */

        return Nagad::setOrderID('ORDERID123')
            ->setAmount('540')
            ->setAddionalInfo(['pid' => 9, 'myName' => 'DG'])
            ->setCallbackUrl("https://manual-callback.url/callback")
            ->checkout()
            ->redirect();
    }

```

To receive the callback response, in your callback controller method:

```
     // in CallbackController.php
    use DGvai\Nagad\Facades\Nagad;
    use Illuminate\Http\Request;

    /**
     * This is the routed callback method
     * which receives a GET request.
     *
     * */

    public function callback(Request $request)
    {
        $verified = Nagad::callback($request)->verify();
        if($verified->success()) {

            // Get Additional Data
            dd($verified->getAdditionalData());

            // Get Full Response
            dd($verified->getVerifiedResponse());
        } else {
            dd($verified->getErrors());
        }
    }
```

Available Methods
-----------------

[](#available-methods)

### For Checking-out

[](#for-checking-out)

- `setOrderID(string $orderID)` : `$orderID` to be any unique AlphaNumeric String
- `setAmount(string $amount)` : `$amount` to be any valid currency numeric String
- `setAddionalInfo(array $array)` : `$array` to be any array to be returned at callback
- `setCallbackUrl(string $url)` : `$url` to be any url string to be overidden the defualt callback url set in config
- `checkout()` : to initiate checkout process.
- `redirect()` : to direct redirect to the NagadPG Web Page.
- `getRedirectUrl()` : instead of redirecting, getting the redirect url manually.

### For Callback

[](#for-callback)

- `callback($request)` : `$request` to be `Illuminate\Http\Request` instance
- `verify()` : to verify the response.
- `success()` : to check if transaction is succeed.
- `getErrors()` : to get the error and errorCode if fails transactions | returns `array[]`
- `getVerifiedResponse()` : to get the full verified response | returns `array[]`
- `getAdditionalData(bool $object)` : to get the additional info passed during checkout. `$object` is to set return object or array.

Changelog
---------

[](#changelog)

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

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

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

2056d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53512998?v=4)[Jalal Uddin](/maintainers/dgvai)[@dgvai](https://github.com/dgvai)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/dgvai-laravel-nagad/health.svg)

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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