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(7mo ago)11MITPHPPHP &gt;=8.1

Since Jan 1Pushed 7mo agoCompare

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

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

28

—

LowBetter than 51% of packages

Maintenance63

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

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

229d 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.7M3.4k](/packages/craftcms-cms)[illuminate/http

The Illuminate Http package.

11938.5M8.2k](/packages/illuminate-http)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[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.

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

Core Framework and Resources for Fleetbase API

1239.7k25](/packages/fleetbase-core-api)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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