PHPackages                             backendprogramer/snapp-pay - 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. backendprogramer/snapp-pay

ActiveLibrary

backendprogramer/snapp-pay
==========================

Installment Payment Gateway, SnappPay

1.1.2(2y ago)9975[3 PRs](https://github.com/backendprogramer/laravel-snapp-pay/pulls)MITPHPPHP ^8.1

Since Aug 26Pushed 2y ago2 watchersCompare

[ Source](https://github.com/backendprogramer/laravel-snapp-pay)[ Packagist](https://packagist.org/packages/backendprogramer/snapp-pay)[ Docs](https://github.com/backendprogramer/snapp-pay)[ RSS](/packages/backendprogramer-snapp-pay/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (8)Used By (0)

[![SnappPay](resources/images/snappPay.png)](resources/images/snappPay.png)

Payment Gateway, SnappPay
=========================

[](#payment-gateway-snapppay)

[![Latest Version on Packagist](https://camo.githubusercontent.com/63b085e1b41512413f5f9f2972bbe0d8b715a10088d6a11ca1bd545597458485/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6261636b656e6470726f6772616d65722f736e6170702d7061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/backendprogramer/snapp-pay)[![GitHub Tests Action Status](https://camo.githubusercontent.com/15ad4a93c203946ea02a0592be26b2d8fafa7c9e8c052195bdc4274ad20940fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6261636b656e6470726f6772616d65722f6c61726176656c2d736e6170702d7061792f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/backendprogramer/laravel-snapp-pay/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/6c3a3055108f3352e8ad92a89899951a1c0ac5804bfb55bb08731b5471a1c2c2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6261636b656e6470726f6772616d65722f6c61726176656c2d736e6170702d7061792f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/backendprogramer/laravel-snapp-pay/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/3f99a2997af74034fbd93fa5933da69e4901f86c05c6867262a35f1c4e144e67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6261636b656e6470726f6772616d65722f736e6170702d7061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/backendprogramer/snapp-pay)

This is a Laravel package for the SnappPay payment gateway. This package supports Laravel 10+.

[Persian documentation for Snappay service](/resources/documents/SnappPay%20Rest%20API%20document-%20Installment%20service%20_Fa.pdf)

[English documentation for Snappay service](/resources/documents/SnappPay%20Rest%20API%20document-%20Installment%20service%20_Fa.pdf)

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

[](#installation)

You can install the package via composer:

```
composer require backendprogramer/snapp-pay
```

You can publish the config file with:

```
php artisan vendor:publish --tag="snapp-pay-config"
```

This is the contents of the published config file:

```
return [
    /**
     * Basic information for SnappPay; obtain this information from SnappPay support.
     */
    'settings' => [
        'user_name'     => env('SNAPPPAY_USERNAME', ''),
        'password'      => env('SNAPPPAY_PASSWORD', ''),
        'client_id'     => env('SNAPPPAY_CLIENT_ID', ''),
        'client_secret' => env('SNAPPPAY_CLIENT_SECRET', ''),
        'base_url'      => env('SNAPPPAY_BASE_URL', ''),
    ],

    /**
     * Endpoints and methods of SnappPay
     * These endpoints are defined by SnappPay; edit it if you need.
     */
    'endpoints' => [
        'bearer_token' => [
            'url'    => env('SNAPPPAY_BEARER_TOKEN_URL', 'api/online/v1/oauth/token'),
            'method' => env('SNAPPPAY_BEARER_TOKEN_METHODE', 'POST'),
        ],
        'merchant_eligible' => [
            'url'    => env('SNAPPPAY_MERCHANT_ELIGIBLE_URL', 'api/online/offer/v1/eligible'),
            'method' => env('SNAPPPAY_MERCHANT_ELIGIBLE_METHODE', 'GET'),
        ],
        'payment_token' => [
            'url'    => env('SNAPPPAY_PAYMENT_TOKEN_URL', 'api/online/payment/v1/token'),
            'method' => env('SNAPPPAY_PAYMENT_TOKEN_METHODE', 'POST'),
        ],
        'payment_verify' => [
            'url'    => env('SNAPPPAY_PAYMENT_VERIFY_URL', 'api/online/payment/v1/verify'),
            'method' => env('SNAPPPAY_PAYMENT_VERIFY_METHODE', 'POST'),
        ],
        'payment_settle' => [
            'url'    => env('SNAPPPAY_PAYMENT_SETTLE_URL', 'api/online/payment/v1/settle'),
            'method' => env('SNAPPPAY_PAYMENT_SETTLE_METHODE', 'POST'),
        ],
        'payment_revert' => [
            'url'    => env('SNAPPPAY_PAYMENT_REVERT_URL', '/api/online/payment/v1/revert'),
            'method' => env('SNAPPPAY_PAYMENT_REVERT_METHODE', 'POST'),
        ],
        'payment_cancel' => [
            'url'    => env('SNAPPPAY_PAYMENT_CANCEL_URL', 'api/online/payment/v1/cancel'),
            'method' => env('SNAPPPAY_PAYMENT_CANCEL_METHODE', 'POST'),
        ],
        'payment_update' => [
            'url'    => env('SNAPPPAY_PAYMENT_UPDATE_URL', 'api/online/payment/v1/update'),
            'method' => env('SNAPPPAY_PAYMENT_UPDATE_METHODE', 'POST'),
        ],
        'payment_status' => [
            'url'    => env('SNAPPPAY_PAYMENT_STATUS_URL', 'api/online/payment/v1/status'),
            'method' => env('SNAPPPAY_PAYMENT_STATUS_METHODE', 'GET'),
        ],
    ],
];
```

Usage
-----

[](#usage)

```
// You can make manual settings as follows
// $snappPaySetting = SnappPaySetting::credentials(
//        'user',
//        'pass',
//        'clientId',
//        'secretSecret',
//        'baseUrl'
//    );
// $snappPay = new SnappPay($snappPaySetting);

// get setting from env or config file snapp-pay
$snappPay = new SnappPay();

$order = new Order(123, 153000, 170000, 10000, 0, Currency::TOMAN, '09121231111');
$category = new ProductCategory('Electronics', 2);
$orderProduct1 = new OrderProduct(1, 'Product 1', 10000, 9000, 2, $category);
$orderProduct2 = new OrderProduct(2, 'Product 2', 50000, 45000, 3, $category);

// You can add the amount of each product to the total price and price of the order as follows
// $order->addProduct($orderProduct1, true);
// $order->addProduct($orderProduct2, true);

$order->addProduct($orderProduct1);
$order->addProduct($orderProduct2);

// Check isMerchantEligible
$merchantEligible = $snappPay->isMerchantEligible($order->getPrice(), Currency::TOMAN);
// Check response $merchantEligible

// Get paymentToken
$paymentToken = $snappPay->getPaymentToken($order, 'https://example.com/payment/succsses/'.$order->getId(), now());
// Check response $paymentToken

// Verify order
$resultVerify = $snappPay->verifyOrder($this->order->getPaymentToken());
// Check response $resultVerify

// Revert order
$resultRevert = $snappPay->revertOrder($this->order->getPaymentToken());
// Check response $resultRevert

// Settle order
$resultSettle = $snappPay->settleOrder($this->order->getPaymentToken());
// Check response $resultSettle

// Remove product from order
$order->removeProduct(2,true);
// Update order
$resultUpdate = $snappPay->updateOrder($order);
// Check response $resultUpdate

// Cancel order
$resultCancel = $snappPay->cancelOrder($order->getPaymentToken());
// Check response $resultCancel
```

For more information about how it works, please refer to the example below.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ali Ghorbani](https://github.com/backendprogramer)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.5% 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

Every ~58 days

Total

4

Last Release

820d ago

### Community

Maintainers

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

---

Top Contributors

[![backendprogramer](https://avatars.githubusercontent.com/u/115031769?v=4)](https://github.com/backendprogramer "backendprogramer (20 commits)")[![aligilani1986](https://avatars.githubusercontent.com/u/77788927?v=4)](https://github.com/aligilani1986 "aligilani1986 (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![hagilani](https://avatars.githubusercontent.com/u/24972047?v=4)](https://github.com/hagilani "hagilani (1 commits)")

---

Tags

laravelbackendprogramersnapp-pay

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/backendprogramer-snapp-pay/health.svg)

```
[![Health](https://phpackages.com/badges/backendprogramer-snapp-pay/health.svg)](https://phpackages.com/packages/backendprogramer-snapp-pay)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[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)

PHPackages © 2026

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