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

Since Jan 1Pushed 4mo agoCompare

[ Source](https://github.com/saeidgi/blupay)[ Packagist](https://packagist.org/packages/saeidgi/blupay)[ RSS](/packages/saeidgi-blupay/feed)WikiDiscussions main Synced 1mo 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

30

—

LowBetter than 64% of packages

Maintenance75

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

137d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9535c56e0771d66b9cabf6d9157f13053b4b3f0a18f015716e93acfc87005b48?d=identicon)[saeidgi](/maintainers/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

[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4845.9k](/packages/sebdesign-laravel-viva-payments)[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)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[henryejemuta/laravel-monnify

A laravel package to seamlessly integrate monnify api within your laravel application

132.1k](/packages/henryejemuta-laravel-monnify)

PHPackages © 2026

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