PHPackages                             naeemz/alfapay - 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. naeemz/alfapay

ActiveLibrary

naeemz/alfapay
==============

Alfa Pay is Bank Alfalah Payment gateway package

31402[3 issues](https://github.com/naeemz/alfapay/issues)PHP

Since Feb 24Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

AlfaPay
=======

[](#alfapay)

[![Latest Version on Packagist](https://camo.githubusercontent.com/642301de4c1e18e0f61bb8c0fedd26d0c42f01e0a355605ea7ad587eb5a67f68/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6165656d7a2f616c66617061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/naeemz/alfapay)[![Total Downloads](https://camo.githubusercontent.com/26e10e67d1e471dd9088c54bcfeb0be7a1d709bb1769fb5737bf14ce663a32ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6165656d7a2f616c66617061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/naeemz/alfapay)[![GitHub Actions](https://github.com/naeemz/alfapay/actions/workflows/main.yml/badge.svg)](https://github.com/naeemz/alfapay/actions/workflows/main.yml/badge.svg)

This is Bank Alfalah payment gateway package to pay using Alfa Wallet, Bank Account Number or Credit Card (Credit Card not yet implemented). You can use this package with Laravel or any PHP framework via composer.

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

[](#installation)

You can install the package via composer:

```
composer require naeemz/alfapay
```

Set .env configurations
-----------------------

[](#set-env-configurations)

You can get these values from Bank Alfalah Merchant portal

```
ALFAPAY_URL=https://sandbox.bankalfalah.com/HS/api/HSAPI/HSAPI
ALFAPAY_CHANNEL_ID=
ALFAPAY_MERCHANT_ID=
ALFAPAY_STORE_ID=
ALFAPAY_RETURN_URL=
ALFAPAY_MERCHANT_USERNAME=
ALFAPAY_MERCHANT_PASSWORD=
ALFAPAY_MERCHANT_HASH=
ALFAPAY_KEY_1=
ALFAPAY_KEY_2=
```

Usage
-----

[](#usage)

First you've to get auth token by providing your unique transaction number or order number and then can post request the amount information along with some validation. Please refer to YouTube video for full understanding.

```
// generate random transaction/order number
$transNum = rand(0,17866120);

// get AuthToken from AlfaPay API
$alfa       = new AlfaPay();
$response   = $alfa->setTransactionReferenceNumber($transNum)->getToken();
//
if( $response != null && $response->success == 'true' ) {
    return $response->AuthToken;
} else {
    // log error
    if( $response == null ) {
        abort(403, 'Error: Timeout connection. Auth Token not generated.');
    } else {
        abort(403, 'Error: '.$response->ErrorMessage.'. Auth Token does not generated.');
    }
}

// Put above generated AuthToken string into hidden field of form
// Next send user info along with AuthToken
// TODO: Please watch YouTube video.
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [naeemz](https://github.com/naeemz)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

14

↓

LowBetter than 2% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 75% 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/085b70df7cb91142aa39f6ba3c6e581238424b2b6c96b1ec0c89e21c15a1772c?d=identicon)[naeemz](/maintainers/naeemz)

---

Top Contributors

[![naeemz](https://avatars.githubusercontent.com/u/4146069?v=4)](https://github.com/naeemz "naeemz (6 commits)")[![codesoclock](https://avatars.githubusercontent.com/u/99901937?v=4)](https://github.com/codesoclock "codesoclock (2 commits)")

### Embed Badge

![Health badge](/badges/naeemz-alfapay/health.svg)

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

PHPackages © 2026

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