PHPackages                             peyman136/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. [Payment Processing](/categories/payments)
4. /
5. peyman136/snapp-pay

ActiveLibrary[Payment Processing](/categories/payments)

peyman136/snapp-pay
===================

Installment Payment Gateway, SnappPay

01PHP

Since Aug 12Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)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/b61c4eb2af5c3d6f2d518489c50c921ea4c2068e23040eb1c869a25f22c46b0d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5065796d616e3133362f736e6170702d7061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Peyman136/snapp-pay)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c7b80fc174dfc1df369ef3dc977828f95d00650a100893432452ba7e8ceda02c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f5065796d616e3133362f6c61726176656c2d736e6170702d7061792f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/Peyman136/laravel-snapp-pay/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/1059097cd3c92c405a746d15859981f39de7813cdfea8e7e6a7f25b0d0adb15f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f5065796d616e3133362f6c61726176656c2d736e6170702d7061792f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/Peyman136/laravel-snapp-pay/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/23b5ce792dd6c2fedd37d0c8227fc8249deb2b08f7f49bb05f576b4b16e4e7c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5065796d616e3133362f736e6170702d7061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Peyman136/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 Peyman136/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/Peyman136)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/braintree

Braintree gateway for Omnipay payment processing library

35558.0k3](/packages/omnipay-braintree)

PHPackages © 2026

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