PHPackages                             fastaar/fastaar-laravel - 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. fastaar/fastaar-laravel

ActiveLibrary[Payment Processing](/categories/payments)

fastaar/fastaar-laravel
=======================

Laravel package for the Fastaar payment gateway

v0.1.0(today)00MITPHPPHP ^8.1

Since Jun 26Pushed todayCompare

[ Source](https://github.com/fastaar/fastaar-laravel)[ Packagist](https://packagist.org/packages/fastaar/fastaar-laravel)[ RSS](/packages/fastaar-fastaar-laravel/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (10)Versions (2)Used By (0)

Fastaar Laravel Package
=======================

[](#fastaar-laravel-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5ed54535717eb64398ed1e9f8f96fab26b13706ee77f008fdbdfb2d7ffbe59e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666173746161722f666173746161722d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fastaar/fastaar-laravel)[![Total Downloads](https://camo.githubusercontent.com/9086ad0cb0da8476f3dc4edc9c2803a3c9b9204072a0e5e9c9a518ffaed6039f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666173746161722f666173746161722d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fastaar/fastaar-laravel)

A modern, developer-friendly Laravel integration for the [Fastaar Payment Gateway](https://fastaar.com) — accept bKash &amp; Nagad payments in Bangladesh.

---

Features
--------

[](#features)

- **Facade &amp; Dependency Injection**: Access Fastaar functionality via `Fastaar` facade or inject `FastaarClient`.
- **Automatic Configuration**: Built-in support for environment variables.
- **Webhook Middleware**: Secure webhook routes automatically using signature validation.
- **Modern PHP Features**: Strict type checking, built on PHP 8.1+.

---

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

[](#installation)

Add the package via Composer:

```
composer require fastaar/fastaar-laravel
```

### Repository Configuration (If installed prior to Packagist publishing)

[](#repository-configuration-if-installed-prior-to-packagist-publishing)

If you are installing this package from a custom VCS repository, define it in your project's `composer.json` first:

```
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/fastaar/fastaar-laravel.git"
    }
],
```

---

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

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --provider="Fastaar\Laravel\FastaarServiceProvider" --tag="fastaar-config"
```

This will create a `config/fastaar.php` configuration file. You can configure Fastaar credentials in your `.env` file:

```
FASTAAR_API_KEY=fk_live_your_api_key_here
FASTAAR_WEBHOOK_SECRET=wh_secret_your_secret_here
FASTAAR_TIMEOUT_SECONDS=15
```

For test environments, use a test key (e.g., `fk_test_...`). Payments auto-complete on the test checkout page without processing real money.

---

Usage
-----

[](#usage)

### 1. Create a Payment &amp; Redirect

[](#1-create-a-payment--redirect)

Initialize payments using the `Fastaar` Facade. The same `invoice_id` is idempotent, meaning you can retry requests without double-charging.

```
use Fastaar\Laravel\Facades\Fastaar;

public function checkout()
{
    try {
        $payment = Fastaar::createPayment([
            'amount' => 1250, // Amount in BDT
            'invoice_id' => 'ORDER-42', // Your order reference
            'success_url' => route('checkout.success'), // Customer returns here on success
            'cancel_url' => route('checkout.cancel'), // Customer returns here on cancellation
        ]);

        return redirect()->away($payment['checkout_url']);
    } catch (\Fastaar\FastaarException $e) {
        return back()->withErrors(['message' => $e->getMessage()]);
    }
}
```

### 2. Check Payment Status

[](#2-check-payment-status)

Retrieve a payment using the payment reference ID or look up by your custom invoice reference ID.

```
use Fastaar\Laravel\Facades\Fastaar;

// Retrieve by payment ID
$payment = Fastaar::getPayment('01jxyz...');

// Look up by your internal invoice/order reference
$payment = Fastaar::findByInvoiceId('ORDER-42');

if ($payment && $payment['status'] === 'completed') {
    // Order is successfully paid
}
```

### 3. List Payments

[](#3-list-payments)

Fetch a list of payments filtered by status or invoice ID, newest first:

```
use Fastaar\Laravel\Facades\Fastaar;

$payments = Fastaar::listPayments([
    'status' => 'completed',
    'per_page' => 10,
]);
```

### 4. Handling Webhooks

[](#4-handling-webhooks)

To secure your webhooks, register the signature verification middleware on your route:

```
use Fastaar\Laravel\Http\Middleware\VerifyWebhookSignature;

Route::post('/webhooks/fastaar', function (Illuminate\Http\Request $request) {
    $event = $request->json()->all();

    if ($event['event'] === 'payment.completed') {
        $orderId = $event['data']['invoice_id'];
        $paymentId = $event['data']['id'];

        // Mark order as paid idempotently using $paymentId as the unique transaction key
    }

    return response('Webhook Handled', 200);
})->middleware(VerifyWebhookSignature::class);
```

Note

Make sure to exclude your webhook route from CSRF protection by adding it to your application's `bootstrap/app.php` (Laravel 11) or `VerifyCsrfToken` middleware (Laravel 9/10).

---

Testing
-------

[](#testing)

Run tests with Pest PHP:

```
./vendor/bin/pest
```

Verify styling and formatting rules:

```
./vendor/bin/pint --test
```

Run static analysis using PHPStan:

```
./vendor/bin/phpstan analyse
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

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

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/295312969?v=4)[Fastaar](/maintainers/fastaar)[@fastaar](https://github.com/fastaar)

---

Top Contributors

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

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fastaar-fastaar-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/fastaar-fastaar-laravel/health.svg)](https://phpackages.com/packages/fastaar-fastaar-laravel)
```

PHPackages © 2026

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