PHPackages                             xeronce/shadhinpay-gateway-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. xeronce/shadhinpay-gateway-laravel

ActiveLibrary

xeronce/shadhinpay-gateway-laravel
==================================

Receive Payments with new era gateway tool

v1.0.0(1mo ago)02MITPHPPHP &gt;=7.4

Since Jul 14Pushed 1mo agoCompare

[ Source](https://github.com/xeronce/shadhinpay-gateway-laravel)[ Packagist](https://packagist.org/packages/xeronce/shadhinpay-gateway-laravel)[ RSS](/packages/xeronce-shadhinpay-gateway-laravel/feed)WikiDiscussions main Synced 1w ago

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

ShadhinPayGateway Payment Gateway Laravel Package
=================================================

[](#shadhinpaygateway-payment-gateway-laravel-package)

An elegant, easy-to-use Laravel integration for ShadhinPayGateway. Fully compatible with Laravel 8, 9, 10, and 11, and PHP 7.4 through 8.x.

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

[](#installation)

Install the package via Composer:

```
composer require xeronce/shadhinpay-gateway-laravel
```

### Local Development / Testing

[](#local-development--testing)

If you are developing or testing this package locally before publishing, add the package to your host Laravel project's `composer.json` using a path repository:

```
"repositories": [
    {
        "type": "path",
        "url": "path/to/shadhinpay-gateway-laravel",
        "options": {
            "symlink": true
        }
    }
],
```

Then run:

```
composer require xeronce/shadhinpay-gateway-laravel:@dev
```

### Zero Configuration

[](#zero-configuration)

Laravel's Package Auto-Discovery will automatically register the service provider and `ShadhinPayGateway` Facade.

If you wish to publish the configuration file, run:

```
php artisan vendor:publish --tag=shadhinpay-gateway-config
```

---

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

[](#configuration)

Add the following environment variables to your `.env` file:

```
SHADHINPAY_GATEWAY_CLIENT_ID=your_client_id
SHADHINPAY_GATEWAY_BUSINESS_ID=your_business_id
SHADHINPAY_GATEWAY_API_KEY=your_x_api_key_access_key
SHADHINPAY_GATEWAY_WEBHOOK_SECRET=your_webhook_signing_secret_optional
SHADHINPAY_GATEWAY_BASE_URL=https://request.shadhinpay.com
```

---

Usage
-----

[](#usage)

### 1. Create a Payment

[](#1-create-a-payment)

To initiate a payment and redirect the customer to ShadhinPayGateway's checkout:

```
use Xeronce\ShadhinpayGateway\Facades\ShadhinpayGateway;

$response = ShadhinpayGateway::pay([
    'amount'        => 500.00,
    'currency'      => 'BDT',
    'merchantTxnId' => 'TXN-' . time(),
    'callbackUrl'   => route('payment.callback'),
    'customerPhone' => '01700000000',
    'customerEmail' => 'customer@example.com',
    'description'   => 'Buying Premium Plan',
]);

if (isset($response['data']['paymentUrl'])) {
    return redirect($response['data']['paymentUrl']);
}

// Handle error
return back()->with('error', $response['message'] ?? 'Payment failed to initialize');
```

### 2. Verify a Payment

[](#2-verify-a-payment)

To verify the payment status using the `paymentId` returned from the checkout callback:

```
use Xeronce\ShadhinpayGateway\Facades\ShadhinpayGateway;

$paymentId = $request->query('paymentId');
$response = ShadhinpayGateway::verify($paymentId);

if (isset($response['data']['status']) && $response['data']['status'] === 'COMPLETED') {
    // Payment is successful
}
```

### 3. Refund a Payment

[](#3-refund-a-payment)

To request a refund for an existing payment:

```
use Xeronce\ShadhinpayGateway\Facades\ShadhinpayGateway;

$response = ShadhinpayGateway::refund($paymentId, [
    'amount' => 500.00,
    'reason' => 'Customer requested cancelation',
    'merchantRef' => 'REF-' . time()
]);
```

---

Webhooks
--------

[](#webhooks)

ShadhinPayGateway automatically dispatches webhooks to notify your application of payment status changes.

The package exposes a POST endpoint at: `/ShadhinPayGateway/webhook`

Important

Since webhook requests are sent from ShadhinPayGateway's servers, you **must exempt** the webhook route from CSRF protection.

**For Laravel 8, 9, and 10:**Add the route to `$except` in `app/Http/Middleware/VerifyCsrfToken.php`:

```
protected $except = [
    'ShadhinPayGateway/webhook',
];
```

**For Laravel 11+:**Add the route to the middleware configuration in `bootstrap/app.php`:

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->validateCsrfTokens(except: [
        'ShadhinPayGateway/webhook',
    ]);
})
```

### Webhook Event Listener

[](#webhook-event-listener)

When a webhook is received, the package verifies the webhook signature (if `ShadhinPayGateway_GATEWAY_SIGNING_SECRET` is defined in `.env`) and fires a `WebhookReceived` event.

You can listen to this event in your `EventServiceProvider`:

```
use Xeronce\ShadhinpayGateway\Events\WebhookReceived;
use App\Listeners\HandleShadhinpayGatewayWebhook;

protected $listen = [
    WebhookReceived::class => [
        HandleShadhinpayGatewayWebhook::class,
    ],
];
```

And in your listener class `HandleShadhinpayGatewayWebhook.php`:

```
namespace App\Listeners;

use Xeronce\ShadhinpayGateway\Events\WebhookReceived;

class HandleShadhinpayGatewayWebhook
{
    public function handle(WebhookReceived $event)
    {
        $payload = $event->payload;
        $eventType = $payload['eventType'] ?? ''; // e.g. PAYMENT.COMPLETED

        if ($eventType === 'PAYMENT.COMPLETED') {
            $paymentData = $payload['data'];
            $paymentId = $paymentData['paymentId'];
            $merchantTxnId = $paymentData['merchantTxnId'];

            // Update your database order status
        }
    }
}
```

Security
--------

[](#security)

If `ShadhinPayGateway_GATEWAY_SIGNING_SECRET` is set, all incoming webhooks are validated using HMAC-SHA256 replay-safe protection to prevent request spoofing.

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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

48d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/xeronce-shadhinpay-gateway-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/xeronce-shadhinpay-gateway-laravel/health.svg)](https://phpackages.com/packages/xeronce-shadhinpay-gateway-laravel)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.5k](/packages/craftcms-cms)[laravel/ai

The official AI SDK for Laravel.

1.1k6.4M360](/packages/laravel-ai)[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[ublabs/blade-simple-icons

A package to easily make use of Simple Icons in your Laravel Blade views.

1868.9k](/packages/ublabs-blade-simple-icons)

PHPackages © 2026

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