PHPackages                             amreljako/fawaterk-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. [Payment Processing](/categories/payments)
4. /
5. amreljako/fawaterk-payment

ActiveLibrary[Payment Processing](/categories/payments)

amreljako/fawaterk-payment
==========================

A Laravel package to integrate with Fawaterk payment API including invoice creation and secure webhook validation.

v1.0.0(9mo ago)15MITPHPPHP ^8.0

Since Aug 5Pushed 9mo agoCompare

[ Source](https://github.com/amreljako/fawaterk-payment)[ Packagist](https://packagist.org/packages/amreljako/fawaterk-payment)[ RSS](/packages/amreljako-fawaterk-payment/feed)WikiDiscussions main Synced 1mo ago

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

Fawaterk Payment Integration for Laravel
========================================

[](#fawaterk-payment-integration-for-laravel)

A Laravel package to easily integrate with the [Fawaterk Payment API](https://fawaterk.com).
It allows you to create invoices, fetch invoice status, and securely handle payment webhooks.

---

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

[](#installation)

> Make sure your Laravel version is 9.x, 10.x, or 11.x and PHP is 8.0+

### Step 1: Require the package via Composer

[](#step-1-require-the-package-via-composer)

If you've tagged a release (e.g. `v1.0.0`):

```
composer require amreljako/fawaterk-payment
```

Or for development:

```
composer require amreljako/fawaterk-payment:dev-main
```

---

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

[](#configuration)

### Step 2: Add your API token to `.env`

[](#step-2-add-your-api-token-to-env)

```
FAWATERK_TOKEN=your_fawaterk_token_here
```

### Step 3: (Optional) Publish the config file

[](#step-3-optional-publish-the-config-file)

```
php artisan vendor:publish --tag=config --provider="AmrEljako\FawaterkPayment\FawaterkServiceProvider"
```

This will publish `config/fawaterk.php`.

---

Usage
-----

[](#usage)

### Step 4: Create an Invoice

[](#step-4-create-an-invoice)

```
use AmrEljako\FawaterkPayment\Fawaterk;

$fawaterk = app(Fawaterk::class);

$response = $fawaterk->createInvoice([
    'payment_method_id' => 2, // 2=Card, 3=Fawry, 4=Wallet
    'cartTotal' => '1000',
    'currency' => 'EGP',
    'invoice_number' => 'INV-' . time(),
    'payLoad' => 'any_custom_payload_like_uuid',
    'customer' => [
        'first_name' => 'John',
        'last_name' => 'Doe',
        'email' => 'john@example.com',
        'phone' => '01000000000',
        'address' => 'Cairo, Egypt'
    ],
    'redirectionUrls' => [
        'successUrl' => route('fawaterk.success'),
        'failUrl' => route('fawaterk.fail'),
        'pendingUrl' => route('fawaterk.pending')
    ],
    'cartItems' => [
        [
            'name' => 'Product Name',
            'price' => '1000',
            'quantity' => '1'
        ]
    ]
]);

return redirect()->away($response->data->payment_data->redirectTo);
```

> 🟠 If you're using **wallet payment** (`payment_method_id = 4`), the phone number must be a valid Egyptian number starting with `01`, e.g., `01012345678`.

---

### Step 5: Get Invoice Data

[](#step-5-get-invoice-data)

```
$invoice = $fawaterk->getInvoice($invoice_id);
```

---

### Step 6: Webhook Handling

[](#step-6-webhook-handling)

Create a webhook route in `routes/web.php`:

```
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use AmrEljako\FawaterkPayment\Fawaterk;

Route::post('/fawaterk/webhook', function (Request $request) {
    $fawaterk = app(Fawaterk::class);

    if (! $fawaterk->verifyWebhook($request->all())) {
        Log::warning('Invalid Fawaterk Webhook!');
        return response()->json(['message' => 'Unauthorized'], 403);
    }

    // Process verified data
    Log::info(' Webhook verified successfully.', $request->all());

    // You can update your order/payment status here

    return response()->json(['message' => 'OK']);
});
```

---

Webhook Signature Verification
------------------------------

[](#webhook-signature-verification)

Fawaterk sends a secure HMAC hash called `hashKey`.
The package automatically verifies the signature using your `FAWATERK_TOKEN`.

---

Supported Payment Methods
-------------------------

[](#supported-payment-methods)

IDMethod2Card3Fawry4Wallets---

Folder Structure
----------------

[](#folder-structure)

```
fawaterk-payment/
├── src/
│   ├── Fawaterk.php
│   └── FawaterkServiceProvider.php
├── config/
│   └── fawaterk.php
└── composer.json

```

---

📎 Example Controller
--------------------

[](#-example-controller)

```
use AmrEljako\FawaterkPayment\Fawaterk;

class PaymentController extends Controller
{
    public function pay()
    {
        $fawaterk = app(Fawaterk::class);

        $invoice = $fawaterk->createInvoice([
            'payment_method_id' => 2,
            'cartTotal' => '1000',
            'currency' => 'EGP',
            'invoice_number' => 'INV-' . time(),
            'payLoad' => 'uuid-1234',
            'customer' => [
                'first_name' => 'Ali',
                'last_name' => 'Saleh',
                'email' => 'ali@example.com',
                'phone' => '01000000000',
                'address' => 'Alexandria'
            ],
            'redirectionUrls' => [
                'successUrl' => route('fawaterk.success'),
                'failUrl' => route('fawaterk.fail'),
                'pendingUrl' => route('fawaterk.pending')
            ],
            'cartItems' => [
                ['name' => 'Ticket', 'price' => '1000', 'quantity' => '1']
            ]
        ]);

        return redirect()->away($invoice->data->payment_data->redirectTo);
    }
}
```

---

Required Routes Example
-----------------------

[](#required-routes-example)

```
Route::view('/payment/success', 'payment.success')->name('fawaterk.success');
Route::view('/payment/fail', 'payment.fail')->name('fawaterk.fail');
Route::view('/payment/pending', 'payment.pending')->name('fawaterk.pending');
```

---

Notes
-----

[](#notes)

- Always store `invoice_id`, `invoice_key`, and `status` for reference.
- `payLoad` can be used to track your order or user.
- Make sure your `.env` has the correct token from your Fawaterk dashboard.

---

License
-------

[](#license)

MIT © [Amr Elsayed](mailto:amreljako@gmail.com)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance57

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

280d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/402b06c86e2b864bfa76b7cb27c3d78072dacb43fd685c9f2987e53f5afc05ac?d=identicon)[amreljako](/maintainers/amreljako)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/amreljako-fawaterk-payment/health.svg)

```
[![Health](https://phpackages.com/badges/amreljako-fawaterk-payment/health.svg)](https://phpackages.com/packages/amreljako-fawaterk-payment)
```

###  Alternatives

[laraveldaily/laravel-invoices

Missing invoices for Laravel

1.5k1.3M4](/packages/laraveldaily-laravel-invoices)[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)

PHPackages © 2026

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