PHPackages                             shipu/php-aamarpay-payment - 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. [API Development](/categories/api)
4. /
5. shipu/php-aamarpay-payment

ActiveLibrary[API Development](/categories/api)

shipu/php-aamarpay-payment
==========================

PHP client for Aamarpay Payment Gateway API

v2.0.0(4y ago)3214.6k—0%18[1 issues](https://github.com/Shipu/php-aamarpay-payment/issues)CC-BY-3.0PHPPHP &gt;=5.6.4

Since Nov 14Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Shipu/php-aamarpay-payment)[ Packagist](https://packagist.org/packages/shipu/php-aamarpay-payment)[ RSS](/packages/shipu-php-aamarpay-payment/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

PHP Aamarpay Payment Gateway
============================

[](#php-aamarpay-payment-gateway)

php-aamarpay-payment is a PHP client for Aamarpay Payment Gateway API. This package is also support Laravel and Lumen.

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

[](#installation)

Go to terminal and run this command

```
composer require shipu/php-aamarpay-payment
```

Wait for few minutes. Composer will automatically install this package for your project.

### For Laravel

[](#for-laravel)

Below **Laravel 5.5** open `config/app` and add this line in `providers` section

```
Shipu\Aamarpay\AamarpayServiceProvider::class,
```

For Facade support you have add this line in `aliases` section.

```
'Aamarpay'   =>  Shipu\Aamarpay\Facades\Aamarpay::class,
```

Then run this command

```
php artisan vendor:publish --provider="Shipu\Aamarpay\AamarpayServiceProvider"
```

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

[](#configuration)

This package is required three configurations.

1. store\_id = your store id in Aamarpay Payment Gateway.
2. signature\_key = your signature key in Aamarpay Payment Gateway
3. sandbox = `true` for sandbox and `false` for live
4. redirect\_url = your application redirect url after `success` and `fail`.

php-aamarpay-payment is take an array as config file. Lets services

```
use Shipu\Aamarpay\Aamarpay;

$config = [
    'store_id' => 'Your store id',
    'signature_key' => 'Your signature key',
    'sandbox' => true,
    'redirect_url' => [
        'success' => [
            'route' => 'payment.success'
        ],
        'cancel' => [
            'route' => 'payment.cancel'
        ]
    ]
];

$payment = new Aamarpay($config);
```

### For Laravel

[](#for-laravel-1)

This package is also support Laravel. For laravel you have to configure it as laravel style.

Go to `config\aamarpay.php` and configure it with your credentials.

```
return [
    'store_id' => 'Your store id',
    'signature_key' => 'Your signature key',
    'sandbox' => true,
    'redirect_url' => [
        'success' => [
            'route' => 'payment.success'
        ],
        'cancel' => [
            'route' => 'payment.cancel'
        ]
    ]
];
```

Usages
------

[](#usages)

- Mandatory input field name
    - tran\_id // auto generate by this package
    - cus\_name
    - cus\_email
    - cus\_phone
    - desc
    - currency // auto generate by this package
    - amount

#### Getting Payment Post Url

[](#getting-payment-post-url)

In PHP:

```
use \Shipu\Aamarpay\Aamarpay;

...

$payment = new Aamarpay($config);
return $payment->paymentUrl();
```

In Laravel:

```
use \Shipu\Aamarpay\Aamarpay;

...

$payment = new Aamarpay(config('aamarpay'));
return $payment->paymentUrl();
```

#### Getting Hidden Input Field

[](#getting-hidden-input-field)

```
use \Shipu\Aamarpay\Aamarpay;

...

$payment = new Aamarpay(config('aamarpay'));
return $payment->customer([
    'cus_name'  => 'Shipu Ahamed', // Customer name
    'cus_email' => 'shipuahamed01@gmail.com', // Customer email
    'cus_phone' => '01616022669' // Customer Phone
])->transactionId('21005455540')->amount(3500)->hiddenValue();
```

Where Transaction id is random value. you can generate by yourself or follow bellow steps:

```
use \Shipu\Aamarpay\Aamarpay;

...

$payment = new Aamarpay(config('aamarpay'));
return $payment->customer([
    'cus_name'  => 'Shipu Ahamed', // Customer name
    'cus_phone' => '01616022669' // Customer Phone
    'cus_email' => 'shipuahamed01@gmail.com', // Customer email
])->transactionId()->amount(3500)->hiddenValue();

or

return $payment->customer([
    'cus_name'  => 'Shipu Ahamed', // Customer name
    'cus_phone' => '01616022669' // Customer Phone
    'cus_email' => 'shipuahamed01@gmail.com', // Customer email
])->amount(3500)->hiddenValue();
```

Default currency is `BDT` . For change currency:

```
return $payment->customer([
    'cus_name'  => 'Shipu Ahamed', // Customer name
    'cus_phone' => '01616022669' // Customer Phone
    'cus_email' => 'shipuahamed01@gmail.com', // Customer email
])->currency()->amount(3500)->hiddenValue();

```

#### Generate Transaction Id

[](#generate-transaction-id)

```
use \Shipu\Aamarpay\Aamarpay;

...

$payment = new Aamarpay(config('aamarpay'));
return $payment->generateTransaction();
```

#### Checking Valid Response

[](#checking-valid-response)

```
use \Shipu\Aamarpay\Aamarpay;

...

$payment = new Aamarpay(config('aamarpay'));
return $payment->valid($request);
```

Checking valid response with amount:

```
use \Shipu\Aamarpay\Aamarpay;

...

$payment = new Aamarpay(config('aamarpay'));
return $payment->valid($request, '3500');
```

Where `$request` will appear after post response.

In Blade
--------

[](#in-blade)

#### Getting Payment Post Url

[](#getting-payment-post-url-1)

```
{{ aamarpay_payment_url() }}
```

#### Getting Hidden Input Field

[](#getting-hidden-input-field-1)

```
{!!
    aamarpay_hidden_input([
        'tran_id'   => '21005455540', // random number. if you don't set this it will be auto generate.
        'cus_name'  => 'Shipu Ahamed', // Customer name
        'cus_email' => 'shipuahamed01@gmail.com', // Customer email
        'cus_phone' => '01616022669' // Customer Phone
    ], 3500)
!!}
or
{!!
    aamarpay_hidden_input([
        'tran_id'   => '21005455540', // random number. if you don't set this it will be auto generate.
        'cus_name'  => 'Shipu Ahamed', // Customer name
        'cus_email' => 'shipuahamed01@gmail.com', // Customer email
        'cus_phone' => '01616022669' // Customer Phone
    ], 3500, 'T-shirt', 'BDT')
!!}
```

#### Complete Post Button View

[](#complete-post-button-view)

```
{!!
aamarpay_post_button([
    'cus_name'  => 'Shipu Ahamed', // Customer name
    'cus_email' => 'shipuahamed01@gmail.com', // Customer email
    'cus_phone' => '01616000000' // Customer Phone
], 2000, 'Payment', 'btn btn-sm btn-success')
!!}
```

Example
-------

[](#example)

##### Route

[](#route)

```
Route::post('payment/success', 'YourMakePaymentsController@paymentSuccess')->name('payment.success');
Route::post('payment/failed', 'YourMakePaymentsController@paymentFailed')->name('payment.failed');
Route::post('payment/cancel', 'YourMakePaymentsController@paymentCancel')->name('payment.cancel');
```

or

```
Route::post('payment/success', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.success');
Route::post('payment/failed', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.failed');
Route::post('payment/cancel', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.cancel');
```

##### Controller Method

[](#controller-method)

```
use Shipu\Aamarpay\Facades\Aamarpay;

...

public function paymentSuccessOrFailed(Request $request)
{
    if($request->get('pay_status') == 'Failed') {
        return redirect()->back();
    }

    $amount = 3500;
    $valid  = Aamarpay::valid($request, $amount);

    if($valid) {
        // Successfully Paid.
    } else {
       // Something went wrong.
    }

    return redirect()->back();
}
```

To Disable CSRF token
---------------------

[](#to-disable-csrf-token)

Open `app/Http/Middleware/VerifyCsrfToken.php` and adding :

```
protected $except = [
    ...
    'payment/*',
    ...
];
```

Credits
-------

[](#credits)

- [Shipu Ahamed](https://github.com/shipu)
- [All Contributors](../../contributors)

Support on Beerpay
------------------

[](#support-on-beerpay)

Hey dude! Help me out for a couple of 🍻!

[![Beerpay](https://camo.githubusercontent.com/8074a283e7c10007e932efa51357a1d3791d7ff9ee4c49746ed5a23742b67775/68747470733a2f2f626565727061792e696f2f53686970752f7068702d61616d61727061792d7061796d656e742d2f62616467652e7376673f7374796c653d626565722d737175617265)](https://beerpay.io/Shipu/php-aamarpay-payment-) [![Beerpay](https://camo.githubusercontent.com/81a4e26b730985a05002d49ebae4bc6878fa3017af68261045f0f86edf2303da/68747470733a2f2f626565727061792e696f2f53686970752f7068702d61616d61727061792d7061796d656e742d2f6d616b652d776973682e7376673f7374796c653d666c61742d737175617265)](https://beerpay.io/Shipu/php-aamarpay-payment-?focus=wish)

###  Health Score

37

↑

LowBetter than 84% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 69.2% 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 ~341 days

Total

5

Last Release

1685d ago

Major Versions

v1.2.1 → v2.0.02021-08-09

PHP version history (2 changes)v1.0PHP &gt;=5.5.9

v1.2PHP &gt;=5.6.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/91fdb46a4f45685ae0d448fbc943b1e4a662b56864b17224a65d14c92ee4e247?d=identicon)[shipu](/maintainers/shipu)

---

Top Contributors

[![Shipu](https://avatars.githubusercontent.com/u/4118421?v=4)](https://github.com/Shipu "Shipu (9 commits)")[![tareqtms](https://avatars.githubusercontent.com/u/5279389?v=4)](https://github.com/tareqtms "tareqtms (2 commits)")[![oalid-cse](https://avatars.githubusercontent.com/u/29829813?v=4)](https://github.com/oalid-cse "oalid-cse (1 commits)")[![shahadat015](https://avatars.githubusercontent.com/u/33991027?v=4)](https://github.com/shahadat015 "shahadat015 (1 commits)")

---

Tags

aamarpaygateway-apilaravellumenphp-clientphpapilaravellumengatewayaamarpayphp-aamarpay

### Embed Badge

![Health badge](/badges/shipu-php-aamarpay-payment/health.svg)

```
[![Health](https://phpackages.com/badges/shipu-php-aamarpay-payment/health.svg)](https://phpackages.com/packages/shipu-php-aamarpay-payment)
```

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3604.0M25](/packages/mollie-laravel-mollie)[jeroen-g/flickr

Modern PHP package to make Flickr API calls. Ships with Laravel implementation.

2559.1k2](/packages/jeroen-g-flickr)[exlo89/laravel-sevdesk-api

A helpful Sevdesk API client for Laravel.

1015.8k](/packages/exlo89-laravel-sevdesk-api)[gufy/whmcs

WHMCS API for Laravel 5

211.7k](/packages/gufy-whmcs)

PHPackages © 2026

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