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

ActiveLibrary[API Development](/categories/api)

hawkiq/laravel-zaincash
=======================

Laravel package to use in Laravel helps you to make dealing with Zain Cash API easier

1.0.6(5mo ago)93761MITPHP

Since Sep 21Pushed 5mo ago1 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

hawkiq Laravel Zain Cash Package
================================

[](#hawkiq-laravel-zain-cash-package)

[![](https://camo.githubusercontent.com/8166137a4ddc2a34e543e19ec5951ea88b98851eb8da246336250f22928c1091/68747470733a2f2f646f63732e7a61696e636173682e69712f6173736574732f696d616765732f6c6f676f2e706e67)](https://zaincash.iq)[![](https://camo.githubusercontent.com/face587bb1c2041c6055a32b76b4c6cad70a549eb0eb1740dd109a866e1b2ef9/68747470733a2f2f6f73616d612e6170702f6173736574732f696d672f6c6f676f2d6f73616d612e706e67)](https://osama.app)

[![Total Downloads](https://camo.githubusercontent.com/f62eb43ab5987de73bfaff7785a158b3ccc7e6515c0fff379aa8821c694f4a09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6861776b69712f6c61726176656c2d7a61696e63617368)](https://packagist.org/packages/hawkiq/laravel-zaincash)[![Latest Stable Version](https://camo.githubusercontent.com/bcfb5e97b7a65d2ac2ec2b256f48a524d6cbec3003a48026782deca43573ae20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6861776b69712f6c61726176656c2d7a61696e63617368)](https://packagist.org/packages/hawkiq/laravel-zaincash)[![License](https://camo.githubusercontent.com/8625c493ce45e22a4353795e35bd71c0f9936d98cf1a6fefafdf0767454f45d2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6861776b69712f6c61726176656c2d7a61696e63617368)](https://packagist.org/packages/hawkiq/laravel-zaincash)

About hawkiq laravel zaincash
-----------------------------

[](#about-hawkiq-laravel-zaincash)

ZainCash offers a simple robust payment gateway to transfer money instantly from anywhere to everywhere inside Iraq, and this package for Laravel developers since there are no official package to use in Laravel so I've decided to create one.

Requiremnt
----------

[](#requiremnt)

VersionPHPLaravel1.x7.1 &lt;= PHP5.8 &lt;= LaravelInstallation
------------

[](#installation)

```
composer require hawkiq/laravel-zaincash

```

Publish config file
-------------------

[](#publish-config-file)

```
php artisan vendor:publish --tag="zaincash"

```

setup redirect route in web.php to handle payment result and put route name in zaincash.php config file

```
Route::get('/redirect', [App\Http\Controllers\HomeController::class, 'redirect'])->name('redirect');
```

all config variables are well described

configDescriptionTypeDefaultmsisdnThe mobile phone number for your wallet, example format: 9647835077893. given by Zain CashString9647835077893secretThis is used to decode and encode JWT during requests. also must be requested from ZainCashStringsecret found in configmerchantidYou can request a Merchant ID from ZainCash's supportString5ffacf6612b5777c6d44266fliveTest enviroment or Live server (true=live , false=test)Boolfalselangsetting langauge for zain cashe payment pageStringenorder\_idyou can use it to help you in tagging transactions with your website IDsString`Str::slug(env('APP_NAME')) . '_hawkiq_'`redirection\_urlto handle payment after successfull First you need to Specify name for redirect route in web.phpStringredirector you can set those parameters inside `.env` file

```
ZCASH_MSISDN=
ZCASH_MERCHANTID=
ZCASH_SECRET=
ZCASH_LANG=en
ZCASH_LIVE=false
ZCASH_CALLBACK_ROUTE="redirect"

```

inside your controller

Now you can use zain cash as API or web just pass the `isWeb` variable value as boolean or use `asApi` method

```
//Your Controller
use Hawkiq\LaravelZaincash\Services\ZainCash;

public function send()
{
    // Now you can use zain cash as API or web just pass the isWeb variable value as boolean or use asApi method
    $zaincash = new ZainCash(); // for normal Web version
    // OR
    $zaincash = (new ZainCash())->asApi(); // for API version
    // OR
    $zaincash = (new ZainCash())->asWeb(false); // for API version

    //The total price of your order in Iraqi Dinar only like 1000 (if in dollar, multiply it by dollar-dinar exchange rate, like 1*1500=1500)
    //Please note that it MUST BE MORE THAN 1000 IQD
    $amount = 1000;

    //Type of service you provide, like 'Books', 'ecommerce cart', 'Hosting services', ...
    $service_type="Shirt";

    //Order id, you can use it to help you in tagging transactions with your website IDs, if you have no order numbers in your website, leave it 1
    $order_id="20222009";

    $payload =  $zaincash->request($amount, $service_type, $order_id);
    return $payload;
}
```

if you used web version it will redirect you to payment page otherwise it will show a response with information about your payload you can use `payment_url` to redirect user inside app.

this will redirect us to Zain Cash page to enter user credentials ( MSISDN and Pin)

[![](https://camo.githubusercontent.com/83ddf2c0ea16fee0f44cb27b406ca7d2fa904d683d095ad73ca7be48315064f7/68747470733a2f2f692e696d6775722e636f6d2f723632763943562e706e67)](https://camo.githubusercontent.com/83ddf2c0ea16fee0f44cb27b406ca7d2fa904d683d095ad73ca7be48315064f7/68747470733a2f2f692e696d6775722e636f6d2f723632763943562e706e67)

you can use this test user

MSISDNPINOTP964780299956912341111We check for status in our callback method in controller

```
//get token from request Url
$token = \Request::input('token');
    if (isset($token)) {
        $zaincash = new ZainCash();
        $result = $zaincash->parse($token);
        if ($result->status == 'success'){ // success ||  failed  || pending
            return 'Thanks for Buying';
            // We can do what ever you like , insert transaction into database, send email etc..
        }
```

result will be in JSON format like this

```
{
   "status":"success",
   "orderid":"laravel_hawkiq_20222009",
   "id":"632eb6cb8726f6b4b8ea2fc3",
   "operationid":"1006596",
   "msisdn":"9647802999569"
}
```

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within hawkiq Laravel Zaincash, please send an e-mail to OsaMa via . All security vulnerabilities will be promptly addressed.

Preview
-------

[](#preview)

this class used in following sites

- [O! Software](https://osama.app).

feel free to contact me if you want to add your site.

Todo
----

[](#todo)

- Add custom redirect route.
- Api version.
- Add additional views for easy integration into blade.

License
-------

[](#license)

Laravel Zaincash is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance73

Regular maintenance activity

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95% 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 ~196 days

Recently: every ~291 days

Total

7

Last Release

151d ago

### Community

Maintainers

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

---

Top Contributors

[![hawkiq](https://avatars.githubusercontent.com/u/7524502?v=4)](https://github.com/hawkiq "hawkiq (19 commits)")[![WaleedAlrashed](https://avatars.githubusercontent.com/u/20885525?v=4)](https://github.com/WaleedAlrashed "WaleedAlrashed (1 commits)")

---

Tags

laravelphpzaincash

### Embed Badge

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

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

###  Alternatives

[google/apiclient

Client library for Google APIs

9.8k191.4M997](/packages/google-apiclient)[docusign/esign-client

The Docusign PHP library makes integrating Docusign into your apps and websites a super fast and painless process. The library is open sourced on GitHub, look for the docusign-esign-php-client repository. Join the eSign revolution!

2087.4M13](/packages/docusign-esign-client)[messagebird/php-rest-api

MessageBird REST API client for PHP

1589.4M22](/packages/messagebird-php-rest-api)[get-stream/stream

A PHP client for Stream (https://getstream.io)

1451.3M8](/packages/get-stream-stream)[plivo/plivo-php

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1102.8M18](/packages/plivo-plivo-php)[plivo/php-sdk

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1101.9M5](/packages/plivo-php-sdk)

PHPackages © 2026

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