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

ActiveLibrary[Payment Processing](/categories/payments)

codeboxr/nagad
==============

Nagad payment gateway laravel

v2.0.1(3y ago)181.3k↑300%8[1 PRs](https://github.com/codeboxrcodehub/nagad/pulls)MITPHPPHP ^7.4|^8.0|^8.1

Since Jul 15Pushed 1y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

Nagad Payment Gateway for Laravel Framework/PHP project
=======================================================

[](#nagad-payment-gateway-for-laravel-frameworkphp-project)

[![Downloads](https://camo.githubusercontent.com/0169c5570d4aa1032fecf042f0ea5cdd343e5b22c595176bb66430726e665776/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6465626f78722f6e61676164)](https://packagist.org/packages/codeboxr/nagad)[![Starts](https://camo.githubusercontent.com/f560366fc464b0442cad519c8300dcda5087511d08ac00987047b2247dc94290/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f636f6465626f78722f6e61676164)](https://packagist.org/packages/codeboxr/nagad)

Features
--------

[](#features)

This is a php/laravel wrapper package for [Nagad MFS](https://nagad.com.bd/)

1. [Create Payment/Take to Payment Page](https://github.com/codeboxrcodehub/nagad#1-create-payment)
2. [Verify Payment/Query Payment/Payment Details](https://github.com/codeboxrcodehub/nagad#2-verify-payment)
3. [Refund Payment](https://github.com/codeboxrcodehub/nagad#3-refund-payment)

Requirements
------------

[](#requirements)

- PHP &gt;=7.4
- Laravel &gt;= 6

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

[](#installation)

```
composer require codeboxr/nagad
```

### vendor publish (config)

[](#vendor-publish-config)

```
php artisan vendor:publish --provider="Codeboxr\Nagad\NagadServiceProvider"
```

After publish config file setup your credential. you can see this in your config directory nagad.php file

```
"sandbox"         => env("NAGAD_SANDBOX", true), // if true it will redirect to sandbox url
"merchant_id"     => env("NAGAD_MERCHANT_ID", ""),
"merchant_number" => env("NAGAD_MERCHANT_NUMBER", ""),
"public_key"      => env("NAGAD_PUBLIC_KEY", ""),
"private_key"     => env("NAGAD_PRIVATE_KEY", ""),
'timezone'        => 'Asia/Dhaka', // By default
"callback_url"    => env("NAGAD_CALLBACK_URL", "http://127.0.0.1:8000/nagad/callback"), // By default you can change it in your callback url
"response_type"   => "json" // By default json you can change response type json/html

```

### Set .env configuration

[](#set-env-configuration)

```
NAGAD_SANDBOX=true // for production use false
NAGAD_MERCHANT_ID=""
NAGAD_MERCHANT_NUMBER=""
NAGAD_PUBLIC_KEY=""
NAGAD_PRIVATE_KEY=""
NAGAD_CALLBACK_URL=""

```

Usage
-----

[](#usage)

### 1. Create Payment

[](#1-create-payment)

```
use Codeboxr\Nagad\Payment\Payment;

return (new Payment)->create($amount, $invoiceNumber)  // 1st parameter is amount and 2nd is unique invoice number

```

or

```
use Codeboxr\Nagad\Facade\NagadPayment;

return NagadPayment::create($amount, $invoiceNumber);

```

### 2. Verify Payment

[](#2-verify-payment)

```
use Codeboxr\Nagad\Payment\Payment;

(new Payment)->verify($paymentRefId) // $paymentRefId which you will find callback URL request parameter

```

or

```
use Codeboxr\Nagad\Facade\NagadPayment;

NagadPayment::verify($paymentRefId);

```

### 3. Refund Payment

[](#3-refund-payment)

```
use Codeboxr\Nagad\Payment\Refund;

(new Refund)->refund($paymentRefId,$refundAmount);

```

or

```
use Codeboxr\Nagad\Facade\NagadRefund;

NagadRefund::refund($paymentRefId,$refundAmount);

```

Note: For the refund method, you have to pass two more parameters one is **reference no** and another **reference message**

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

[](#contributing)

Contributions to the Nagad Payment Gateway package are welcome. Please note the following guidelines before submitting your pull request.

- Follow [PSR-4](http://www.php-fig.org/psr/psr-4/) coding standards.
- Read Nagad API documentations first. Please contact with Nagad for their api documentation and sandbox access.

License
-------

[](#license)

This repository is licensed under the [MIT License](http://opensource.org/licenses/MIT).

Copyright 2022 [Codeboxr](https://codeboxr.com). We are not not affiliated with Nagad and don't give any guarantee.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~15 days

Total

5

Last Release

1339d ago

Major Versions

v1.0.2 → v2.02022-09-01

PHP version history (2 changes)v1.0.2PHP ^7.2|^7.3|^8.0|^8.1

v2.0PHP ^7.4|^8.0|^8.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/81623abb96d5e8d150207d166effa3d73f4853bb9006cb9df7bef67ff65853bf?d=identicon)[codeboxr](/maintainers/codeboxr)

---

Top Contributors

[![dipudey](https://avatars.githubusercontent.com/u/50619501?v=4)](https://github.com/dipudey "dipudey (24 commits)")[![manchumahara](https://avatars.githubusercontent.com/u/204452?v=4)](https://github.com/manchumahara "manchumahara (4 commits)")

---

Tags

bd-paymentlaravellaravel-nagad-paymentlaravel-packagenagad-apinagad-api-librarynagad-gatewaynagad-php-librarynagad-php-packagenagad-php-payment-gatewaypaymentpaymentsphpnagadnagad payment gatewaynagad-paymentlaravel-nagadlaravel-nagad-payment

### Embed Badge

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

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

###  Alternatives

[laraveldaily/laravel-invoices

Missing invoices for Laravel

1.5k1.3M4](/packages/laraveldaily-laravel-invoices)[code4mk/lara-nagad

Laravel nagad payment package

352.3k](/packages/code4mk-lara-nagad)[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)

PHPackages © 2026

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