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

ActiveLibrary[Payment Processing](/categories/payments)

madarit/laravel-kashier
=======================

Laravel package for integrating Kashier payment gateway

00PHP

Since Nov 24Pushed 5mo agoCompare

[ Source](https://github.com/madarit/Kashier-Laravel)[ Packagist](https://packagist.org/packages/madarit/laravel-kashier)[ RSS](/packages/madarit-laravel-kashier/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Kashier Payment Integration
===================================

[](#laravel-kashier-payment-integration)

A Laravel package for integrating Kashier payment gateway into your Laravel application with ease.

Features
--------

[](#features)

- ✅ Easy installation via Composer
- ✅ Auto-discovery for Laravel 5.5+
- ✅ Support for both test and live modes
- ✅ iFrame and Hosted Payment Page (HPP) integration
- ✅ Automatic signature validation
- ✅ Customizable views
- ✅ Facade support for easy access

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Laravel 9.0, 10.0, or 11.0

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require madarit/laravel-kashier
```

The package will automatically register itself via Laravel's package auto-discovery.

### 2. Publish Configuration

[](#2-publish-configuration)

Publish the configuration file to customize settings:

```
php artisan vendor:publish --tag=kashier-config
```

This will create `config/kashier.php` in your application.

### 3. Publish Views (Optional)

[](#3-publish-views-optional)

If you want to customize the payment views:

```
php artisan vendor:publish --tag=kashier-views
```

Views will be published to `resources/views/vendor/kashier/`.

### 4. Configure Environment Variables

[](#4-configure-environment-variables)

Add the following to your `.env` file:

```
KASHIER_MODE=test
KASHIER_TEST_API_KEY=your-test-api-key
KASHIER_TEST_MID=your-test-mid
KASHIER_LIVE_API_KEY=
KASHIER_LIVE_MID=
```

Replace the test credentials with your actual Kashier credentials from your merchant dashboard.

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use Madarit\LaravelKashier\Facades\Kashier;

// Generate order hash
$hash = Kashier::generateOrderHash($orderId, $amount, $currency);

// Get HPP URL
$hppUrl = Kashier::getHppUrl($orderId, $amount, $currency, $callbackUrl);

// Validate callback signature
$isValid = Kashier::validateSignature($request->all());

// Get configuration
$config = Kashier::getConfig();
$mode = Kashier::getMode();
$mid = Kashier::getMid();
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use Madarit\LaravelKashier\KashierService;

class YourController extends Controller
{
    private $kashier;

    public function __construct(KashierService $kashier)
    {
        $this->kashier = $kashier;
    }

    public function processPayment()
    {
        $hash = $this->kashier->generateOrderHash('123', '100', 'EGP');
        // ...
    }
}
```

### Default Routes

[](#default-routes)

The package automatically registers these routes:

- `GET /kashier/checkout` - Display checkout page
- `GET /kashier/iframe/callback` - iFrame payment callback
- `GET /kashier/hpp/callback` - Hosted Payment Page callback

### Accessing the Demo

[](#accessing-the-demo)

After installation, visit:

```
http://your-app.test/kashier/checkout

```

### Test Cards

[](#test-cards)

- **Success:** 5111 1111 1111 1118 - 06/28 - 100
- **Success 3D Secure:** 5123 4500 0000 0008 - 06/28 - 100
- **Failure:** 5111 1111 1111 1118 - 05/28 - 102

Customization
-------------

[](#customization)

### Custom Views

[](#custom-views)

After publishing views, you can customize them in `resources/views/vendor/kashier/`:

- `payment/checkout.blade.php` - Checkout page
- `payment/success.blade.php` - Success page
- `payment/error.blade.php` - Error page

### Custom Controller

[](#custom-controller)

You can create your own controller and use the KashierService:

```
use Madarit\LaravelKashier\KashierService;
use Illuminate\Http\Request;

class CustomPaymentController extends Controller
{
    public function initiatePayment(KashierService $kashier)
    {
        $orderId = uniqid('order_');
        $amount = '100.00';
        $currency = 'EGP';

        $hppUrl = $kashier->getHppUrl(
            $orderId,
            $amount,
            $currency,
            route('payment.callback')
        );

        return redirect($hppUrl);
    }

    public function handleCallback(Request $request, KashierService $kashier)
    {
        if ($kashier->validateSignature($request->all())) {
            if ($request->get('paymentStatus') === 'SUCCESS') {
                // Handle successful payment
                return view('payment-success');
            }
        }

        return view('payment-failed');
    }
}
```

Package Structure
-----------------

[](#package-structure)

```
laravel-kashier/
├── src/
│   ├── Http/
│   │   └── Controllers/
│   │       └── PaymentController.php
│   ├── Facades/
│   │   └── Kashier.php
│   ├── KashierService.php
│   └── KashierServiceProvider.php
├── config/
│   └── kashier.php
├── resources/
│   └── views/
│       └── payment/
│           ├── checkout.blade.php
│           ├── success.blade.php
│           └── error.blade.php
├── routes/
│   └── web.php
├── composer.json
└── README.md

```

API Reference
-------------

[](#api-reference)

### KashierService Methods

[](#kashierservice-methods)

#### `generateOrderHash($orderId, $amount, $currency, $customerReference = null)`

[](#generateorderhashorderid-amount-currency-customerreference--null)

Generate hash for order verification.

#### `validateSignature($queryParams)`

[](#validatesignaturequeryparams)

Validate callback signature for security.

#### `getHppUrl($orderId, $amount, $currency, $callbackUrl, $allowedMethods = 'card,wallet,bank_installments')`

[](#gethppurlorderid-amount-currency-callbackurl-allowedmethods--cardwalletbank_installments)

Generate Hosted Payment Page URL.

#### `getConfig()`

[](#getconfig)

Get current configuration (test/live).

#### `getMode()`

[](#getmode)

Get current mode (test/live).

#### `getMid()`

[](#getmid)

Get merchant ID.

#### `getBaseUrl()`

[](#getbaseurl)

Get Kashier base URL.

Payment Flow
------------

[](#payment-flow)

### iFrame Payment

[](#iframe-payment)

1. User visits `/payment/checkout`
2. Clicks the Kashier payment button
3. Payment popup opens on the same page
4. After payment, redirects to `/payment/iframe/callback`
5. Signature is validated
6. User sees success or error page

### Hosted Payment Page (HPP)

[](#hosted-payment-page-hpp)

1. User visits `/payment/checkout`
2. Clicks "Pay with Hosted Payment Page" link
3. Redirected to Kashier's hosted page
4. After payment, redirected back to `/payment/hpp/callback`
5. Signature is validated
6. User sees success or error page

Security
--------

[](#security)

- All callbacks validate the signature using HMAC SHA256
- Never expose your API keys in frontend code
- Always validate signatures before processing payments
- Log failed signature validations for security monitoring

Going Live
----------

[](#going-live)

1. Obtain live credentials from Kashier merchant dashboard
2. Update `.env` file with live credentials
3. Change `KASHIER_MODE` to `live`
4. Test thoroughly before processing real payments

Support
-------

[](#support)

For issues or questions:

- Kashier Documentation:
- Kashier Support: Contact through merchant dashboard

About the Developer
-------------------

[](#about-the-developer)

This package is developed and maintained by **Madar IT** - a software development company specializing in creating robust and scalable solutions for businesses.

### Madar IT

[](#madar-it)

**Madar IT** provides professional software development services with expertise in:

- Laravel &amp; PHP Development
- Payment Gateway Integration
- API Development &amp; Integration
- Enterprise Application Development
- Custom Software Solutions

We are committed to delivering high-quality, secure, and well-documented packages that make developers' lives easier.

### Connect With Us

[](#connect-with-us)

- **GitHub:** [github.com/madarit](https://github.com/madarit)
- **Website:** Contact us for custom development and integration services

For package-related issues, please open an issue on the GitHub repository. For custom development or integration services, feel free to reach out directly.

License
-------

[](#license)

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

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance48

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

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/3ef1a98c0eb4c628e40bdcc2268fe9da2bc756acfe519e676d85595065cc1372?d=identicon)[madarit](/maintainers/madarit)

---

Top Contributors

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

### Embed Badge

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

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

###  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/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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