PHPackages                             zfhassaan/easypaisa - 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. zfhassaan/easypaisa

ActiveLibrary[Payment Processing](/categories/payments)

zfhassaan/easypaisa
===================

Unlock the power of EasyPaisa Payment Gateway in Laravel 9 and Laravel 10. Accept payments seamlessly and securely, empowering your business to thrive in the digital era. Experience hassle-free integration and provide a seamless checkout experience for your customers.

v1.0.5(2y ago)131.6k↑91.7%41MITPHPPHP ^8.1

Since May 23Pushed 2y ago1 watchersCompare

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

READMEChangelog (6)Dependencies (1)Versions (8)Used By (1)

 [![EASYPAISA Payment Gateway](logo.png)](logo.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/42272a179e75b35941392233d2062a53d20167eaab89dffdc7b1ae03307a6040/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a666861737361616e2f6561737970616973612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zfhassaan/easypaisa)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/488f07f0e9176a8d43cabcbec727682e4c479f056357e0812d96aad7419ca3ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a666861737361616e2f6561737970616973612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zfhassaan/easypaisa)[![Hits](https://camo.githubusercontent.com/8553fbe84c019329cbf85a767d26a27e2a706efce60957cb35d467f72f3534e7/68747470733a2f2f686974732e736565796f756661726d2e636f6d2f6170692f636f756e742f696e63722f62616467652e7376673f75726c3d68747470732533412532462532466769746875622e636f6d2532467a666861737361616e25324665617379706169736126636f756e745f62673d253233373943383344267469746c655f62673d2532333535353535352669636f6e3d73616d73756e677061792e7376672669636f6e5f636f6c6f723d253233453745374537267469746c653d6869747326656467655f666c61743d66616c7365)](https://hits.seeyoufarm.com)

Disclaimer
----------

[](#disclaimer)

This is unofficial Easypaisa API Payment Gateway. This repository is only created to help developers in streamlining the integration process.

Installation
============

[](#installation)

The Package provides two way of using.

- Direct Checkout
- Hosted Checkout.

To use the Direct checkout ( Rest API ) you can call the already defined function `sendRequest()` and to use the Hosted Checkout (Redirection Method) you can call the `sendHostedRequest()` method to redirect user to easypaisa page for payment.

To install the EasyPaisa package, follow these steps:

Install the package via Composer by running the following command:

```
composer require zfhassaan/easypaisa
```

Publish the package configuration file by running the following command:

```
php artisan vendor:publish
```

Update the `.env` file with the required configuration values:

```
EASYPAISA_MODE=sandbox
EASYPAISA_SANDBOX_URL=
EASYPAISA_PRODUCTION_URL=
EASYPAISA_TYPE=direct
EASYPAISA_SANDBOX_USERNAME=
EASYPAISA_SANDBOX_PASSWORD=
EASYPAISA_SANDBOX_STOREID=
EASYPAISA_PRODUCTION_USERNAME=
EASYPAISA_PRODUCTION_PASSWORD=
EASYPAISA_PRODUCTION_STOREID=
EASYPAISA_PAYMENT_TYPE=MA
EASYPAISA_SANDBOX_HASHKEY=
EASYPAISA_PRODUCTION_HASHKEY=
EASYPAISA_CALLBACK_URL=
EASYPAISA_HOSTED_CHECKOUT=
```

Usage
=====

[](#usage)

Direct Checkout
---------------

[](#direct-checkout)

To perform a direct checkout using the EasyPaisa payment gateway, use the following code:

```
try {
    $easypaisa = new Easypaisa;
    $response = $easypaisa->sendRequest($request->all());
    $responseCode = $response['responseCode'];
    $responseDesc = $response['responseDesc'];

    if ($responseCode != '0000') {
        return response()->json(['status' => false, 'message' => $responseDesc], Response::HTTP_NOT_ACCEPTABLE);
    }

    $result = [
        'status_code' => '00',
        'status_msg' => $response['responseDesc'],
        'transaction_id' => $response['transactionId'],
        'code' => $response['responseCode'],
        'message' => $response['responseDesc'],
        'basket_id' => strip_tags($request['orderId'])
    ];
    return response()->json($result);
} catch (\Exception $e) {
    return response()->json(['status' => false, 'message' => 'Error Processing Your Request.'], 500);
}
```

The `sendRequest()` method of the Easypaisa class processes the payment request. It takes an array of request data as input and returns the response from the EasyPaisa payment gateway.

`Package File: Easypaisa.php`The sendRequest() method is defined in the Easypaisa package file. It processes the payment request by sending the data to the EasyPaisa API.

```
$credentials = $this->getCredentials();

$data = [
    'orderId' => strip_tags($request['orderId']),
    'storeId' => $this->getStoreId(),
    'transactionAmount' => strip_tags($request['amount']),
    'transactionType' => 'MA',
    'mobileAccountNo' => strip_tags($request['mobileAccountNo']),
    'emailAddress' => strip_tags($request['emailAddress'])
];
$response = Http::timeout(60)->withHeaders([
    'credentials' => $credentials,
    'Content-Type' => 'application/json'
])->post($this->getApiUrl(), $data);

$result = $response->json();

return $result;
```

The getCredentials() method retrieves the credentials based on the configuration settings

Hosted Checkout
---------------

[](#hosted-checkout)

To perform a hosted checkout using the EasyPaisa payment gateway, use the following code:

```
$data['amount'] = strip_tags($request['amount']);  //Last two digits will be considered as Decimal
        $data['orderRefNum'] = strip_tags($request['orderRefNum']); // You can customize it (only Max 20 Alpha-Numeric characters)
        $data['paymentMethod'] = 'InitialRequest';
        $data['postBackURL'] = $this->getCallbackUrl();
        $data['storeId'] = $this->getStoreId();
        $data['timeStamp'] = $this->getTimestamp();
        $hashk = $this->gethashRequest($data);
        $data['encryptedHashRequest'] = $hashk;
        $data['mobileAccountNo'] = '';
        return $this->getCheckoutUrl($data);
```

The gethashRequest() method retrieves the HashKey after encryption. The getCheckoutUrl() method retrieves the checkouturl which will redirect the customer to the Easypaisa portal.

Hosted.blade.php
================

[](#hostedbladephp)

```

@csrf

```

Controller
==========

[](#controller)

```
public function index(Request $request)
    {

        $easypaisa = new Easypaisa();
        $response = $easypaisa->sendHostedRequest($request->all());
        return redirect()->away($response,302);

    }
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.2% 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 ~1 days

Total

6

Last Release

1084d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3f91e22a64582fa1db957f7f189736d6cd2e6f1f69c2236a42a9ee8fcbdd0723?d=identicon)[zfhassaan](/maintainers/zfhassaan)

---

Top Contributors

[![zfhassaan](https://avatars.githubusercontent.com/u/17079656?v=4)](https://github.com/zfhassaan "zfhassaan (32 commits)")[![salman-mahmood](https://avatars.githubusercontent.com/u/28801084?v=4)](https://github.com/salman-mahmood "salman-mahmood (6 commits)")

---

Tags

easypaisapakistanpayment-gatewaytelenor

### Embed Badge

![Health badge](/badges/zfhassaan-easypaisa/health.svg)

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

###  Alternatives

[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

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