PHPackages                             payguard/bagisto-payguard - 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. payguard/bagisto-payguard

ActiveBagisto-package[Payment Processing](/categories/payments)

payguard/bagisto-payguard
=========================

PayGuard payment gateway for Bagisto — adds bKash and Nagad checkout for Bangladesh merchants

1.0.0(today)00MITPHPPHP ^8.1

Since Jul 30Pushed todayCompare

[ Source](https://github.com/abefimrs/bagisto-payguard)[ Packagist](https://packagist.org/packages/payguard/bagisto-payguard)[ Docs](https://github.com/abefimrs/bagisto-payguard)[ RSS](/packages/payguard-bagisto-payguard/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

PayGuard for Bagisto
====================

[](#payguard-for-bagisto)

[![Packagist Version](https://camo.githubusercontent.com/65a7808b8f862f316f46492b4036848ea2ae35da85ac0688c79f777346905a4e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70617967756172642f6261676973746f2d7061796775617264)](https://packagist.org/packages/payguard/bagisto-payguard)[![Bagisto](https://camo.githubusercontent.com/ec676fd3aa364d04144ece62ba13c32bd55d5bdd56e4ee712261389a912767ff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4261676973746f2d322e782d6f72616e6765)](https://bagisto.com)[![PHP](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://php.net)[![License: MIT](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](LICENSE)

Accept **bKash** and **Nagad** payments in your Bagisto store, powered by [PayGuard](https://app.sourcemonkey.online) — the payment gateway built for Bangladesh merchants.

---

Features
--------

[](#features)

- ✅ bKash and Nagad as separate checkout payment options
- ✅ Full redirect flow: order → PayGuard → bKash/Nagad → return
- ✅ HMAC-SHA256 signed webhook — reliable server-to-server confirmation
- ✅ Auto invoice creation on `payment.success` webhook
- ✅ Transaction ID stored and displayed in the admin order view
- ✅ Per-method PayGuard connection IDs
- ✅ Zero code changes needed after install — fully admin-configurable

---

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

[](#requirements)

RequirementVersionPHP^8.1Bagisto^2.0PayGuard account[app.sourcemonkey.online](https://app.sourcemonkey.online)---

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

[](#installation)

```
composer require payguard/bagisto-payguard
php artisan optimize:clear
```

Laravel auto-discovery registers the service provider automatically — no manual `bootstrap/providers.php` edits needed.

---

Configuration
-------------

[](#configuration)

### Step 1 — PayGuard Dashboard

[](#step-1--payguard-dashboard)

Log into [app.sourcemonkey.online](https://app.sourcemonkey.online) and collect:

ItemWhere to find itAPI KeyAPI &amp; Webhooks → Generate KeyWebhook SecretConnections → Edit → Webhook SecretbKash Connection IDConnections → bKash row → ID columnNagad Connection IDConnections → Nagad row → ID columnSet your store's webhook URL in PayGuard to:

```
https://yourdomain.com/api/payguard/webhook

```

### Step 2 — Bagisto Admin Panel

[](#step-2--bagisto-admin-panel)

Go to **Admin → Configuration → Sales → PayGuard Settings**:

FieldValueAPI KeyFrom PayGuard dashboardAPI Base URL`https://app.sourcemonkey.online/api/v1`Webhook SecretFrom PayGuard dashboardThen configure each method under **PayGuard - bKash** and **PayGuard - Nagad**:

FieldValueStatusYesTitlebKash (or Nagad) — shown to customers at checkoutConnection IDYour bKash (or Nagad) connection ID from PayGuard---

How It Works
------------

[](#how-it-works)

```
Customer clicks "Place Order"
    → PayGuardController::redirect()
        → Bagisto order created
        → PayGuard transaction opened  (POST /api/v1/transactions)
        → bKash/Nagad initiated        (POST /api/v1/bkash/initiate/{id})
        → Customer redirected to bKash/Nagad checkout page

Customer completes payment on bKash/Nagad
    → Browser returns to /payguard/callback/{provider}
        → Transaction ID saved to order_payments.additional
        → Invoice created (best-effort)
        → Customer redirected to order success page

PayGuard server calls your webhook
    → POST /api/payguard/webhook
        → HMAC-SHA256 signature verified
        → Transaction ID saved to order
        → Order marked paid + invoice created  ← authoritative source of truth

```

The webhook is the source of truth. Invoice creation happens here regardless of whether the customer's browser makes it back to your site.

---

Admin Order View
----------------

[](#admin-order-view)

After a successful payment, the PayGuard **Transaction ID** is displayed in the Admin → Sales → Orders → view page under the payment method section:

```
Payment & Shipping
──────────────────
bKash
Payment Method   bKash
Transaction ID   DGU3VY9R39

```

---

Routes
------

[](#routes)

The plugin registers three public routes:

MethodURLPurposeGET`/payguard/redirect/{provider}`Entry point from checkout — creates order and redirects to PayGuardGET`/payguard/callback/{provider}`Browser return from PayGuard after paymentPOST`/api/payguard/webhook`Signed server-to-server IPN from PayGuard`{provider}` is `bkash` or `nagad`.

The webhook route is CSRF-exempt (server-to-server call) but every request is verified with HMAC-SHA256 before any action is taken.

---

Local Development (Webhook Testing)
-----------------------------------

[](#local-development-webhook-testing)

PayGuard can't reach `localhost`. Use [ngrok](https://ngrok.com) to expose your local server:

```
ngrok http 8000
```

Copy the `https://...ngrok-free.app` URL and temporarily set it as `APP_URL` in your `.env`:

```
APP_URL=https://a1b2c3d4.ngrok-free.app

```

Then run `php artisan config:clear` and test a full checkout. Switch `APP_URL` back to `http://localhost:8000` when done.

---

Package Structure
-----------------

[](#package-structure)

```
src/
├── Config/
│   ├── payment-methods.php       # Registers payguard_bkash + payguard_nagad
│   └── system.php                # Admin config fields (API key, connection IDs, etc.)
├── Http/Controllers/
│   └── PayGuardController.php    # redirect() / callback() / webhook()
├── Payment/
│   ├── AbstractPayGuardPayment.php
│   ├── PayGuardBkash.php
│   └── PayGuardNagad.php
├── Providers/
│   └── PayGuardServiceProvider.php  # Routes, views, render event hook
├── Resources/views/admin/orders/
│   └── payment-info.blade.php    # Transaction ID block in admin order view
├── Routes/
│   └── web.php
└── Services/
    └── PayGuardClient.php        # HTTP client for PayGuard API + HMAC verification

```

---

Changelog
---------

[](#changelog)

### 1.0.0 — 2026-07-30

[](#100--2026-07-30)

- Initial release
- bKash + Nagad checkout via PayGuard redirect flow
- HMAC-SHA256 webhook signature verification
- Transaction ID saved and displayed in admin order view
- Auto invoice creation on payment confirmation

---

Support
-------

[](#support)

- PayGuard docs: [app.sourcemonkey.online/docs](https://app.sourcemonkey.online/docs)
- Issues: [github.com/abefimrs/bagisto-payguard/issues](https://github.com/abefimrs/bagisto-payguard/issues)
- PayGuard dashboard: [app.sourcemonkey.online](https://app.sourcemonkey.online)

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/757463?v=4)[Md. Sanaullah asif](/maintainers/abefimrs)[@abefimrs](https://github.com/abefimrs)

---

Top Contributors

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

---

Tags

laravelpaymentecommercebagistobkashnagadbangladeshpayguard

### Embed Badge

![Health badge](/badges/payguard-bagisto-payguard/health.svg)

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

###  Alternatives

[codenteq/stripe-payment-gateway

The Laravel eCommerce Stripe Payment Gateway

233.9k](/packages/codenteq-stripe-payment-gateway)[codenteq/iyzico-payment-gateway

The Laravel eCommerce Iyzico Payment Gateway

121.0k](/packages/codenteq-iyzico-payment-gateway)

PHPackages © 2026

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