PHPackages                             saeidgi/blupay - 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. saeidgi/blupay

ActiveLibrary[Payment Processing](/categories/payments)

saeidgi/blupay
==============

BluPay (SEP / pg-neo) payment gateway for Laravel

v0.1.0(6mo ago)11MITPHPPHP &gt;=8.1

Since Jan 1Pushed 6mo agoCompare

[ Source](https://github.com/saeidgi/blupay)[ Packagist](https://packagist.org/packages/saeidgi/blupay)[ RSS](/packages/saeidgi-blupay/feed)WikiDiscussions main Synced today

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

LidLike BluPay (SEP / pg-neo) for Laravel
=========================================

[](#lidlike-blupay-sep--pg-neo-for-laravel)

About This Package
------------------

[](#about-this-package)

BluPay was initially developed as an internal utility for personal use in real-world projects. To facilitate adoption and reduce integration effort for other development teams, it was later refactored and published as an independent, open-source package with clear documentation.

A lightweight Laravel package for integrating **SEP (Saman Electronic Payment)** Internet Payment Gateway (IPG), including **pg-neo** behavior.

> 📘 **Persian Documentation:**
> برای مطالعه راهنمای فارسی این پکیج، به فایل
> [README.fa.md](README.fa.md)
> مراجعه کنید.

Features
--------

[](#features)

- Request Token (JSON POST)
- Redirect customer to payment page (POST form or GET SendToken)
- Verify transaction
- Reverse transaction
- Supports pg-neo: reads payment URL from `X-IPG-Url` header when provided

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

[](#requirements)

- PHP &gt;= 8.1
- Laravel 10 / 11 / 12
- guzzlehttp/guzzle ^7

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

[](#installation)

```
composer require saeidgi/blupay
php artisan vendor:publish --tag=blupay-config
```

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

[](#configuration)

Add to `.env`:

```
BLUPAY_TERMINAL_ID=2015
BLUPAY_TIMEOUT=30
```

Optional endpoint overrides:

```
BLUPAY_TOKEN_URL=https://sep.shaparak.ir/onlinepg/onlinepg
BLUPAY_PAY_URL=https://sep.shaparak.ir/OnlinePG/OnlinePG
BLUPAY_SEND_URL=https://sep.shaparak.ir/OnlinePG/SendToken
BLUPAY_VERIFY_URL=https://sep.shaparak.ir/verifyTxnRandomSessionkey/ipg/VerifyTransaction
BLUPAY_REVERSE_URL=https://sep.shaparak.ir/verifyTxnRandomSessionkey/ipg/ReverseTransaction
```

Usage
-----

[](#usage)

### 1) Request Token

[](#1-request-token)

```
use BluPay;

$tokenResp = BluPay::driver()->requestToken(
    amount: 12000,
    resNum: 'ORDER-123',
    redirectUrl: route('pay.callback'),
    cellNumber: '09120000000'
);

if (!$tokenResp->success) {
    return response()->json([
        'errorCode' => $tokenResp->errorCode,
        'errorDesc' => $tokenResp->errorDesc,
    ], 422);
}

$token = $tokenResp->token;
```

### 2) Redirect Customer to Payment Gateway

[](#2-redirect-customer-to-payment-gateway)

#### Option A: GET Redirect (SendToken)

[](#option-a-get-redirect-sendtoken)

```
return redirect()->away(
    BluPay::driver()->redirectUrl($token)
);
```

#### Option B: POST Form Redirect (OnlinePG)

[](#option-b-post-form-redirect-onlinepg)

If you prefer POST redirect (HTML form), use the documented `OnlinePG` action endpoint.

### 3) Handle Callback + Verify

[](#3-handle-callback--verify)

```
use BluPay;
use Illuminate\Http\Request;

Route::post('/pay/callback', function (Request $request) {
    $refNum = $request->input('RefNum');

    $verify = BluPay::driver()->verify($refNum);

    if ($verify->success !== true) {
        return response()->json([
            'ok' => false,
            'resultCode' => $verify->resultCode,
            'resultDescription' => $verify->resultDescription,
        ], 400);
    }

    // IMPORTANT: Compare verified amount with your expected amount before fulfilling the order.
    return response()->json([
        'ok' => true,
        'transactionDetail' => $verify->transactionDetail,
    ]);
})->name('pay.callback');
```

### 4) Reverse Transaction

[](#4-reverse-transaction)

```
$reverse = BluPay::driver()->reverse($refNum);

if (!$reverse->success) {
    // handle failed reverse
}
```

pg-neo Support (Important)
--------------------------

[](#pg-neo-support-important)

In pg-neo, after requesting token, the gateway base URL may be returned in response headers:

- Header: `X-IPG-Url`
- Example: `https://neo-pg.sep.ir/transaction/init`

This package exposes that header via:

```
$tokenResp->ipgUrlFromHeader;
```

License
-------

[](#license)

MIT

Disclaimer
----------

[](#disclaimer)

This package is an independent open-source client implementation based on publicly available technical documentation of the SEP payment gateway. It is not an official product of Saman Electronic Payment and is provided "as is" without any warranty.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance69

Regular maintenance activity

Popularity3

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

183d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/829894?v=4)[Saeid Ghaznavi](/maintainers/saeidgi)[@saeidgi](https://github.com/saeidgi)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/saeidgi-blupay/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4851.0k](/packages/sebdesign-laravel-viva-payments)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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