PHPackages                             mantraideas/laravel-fonepay - 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. mantraideas/laravel-fonepay

ActiveLibrary[Payment Processing](/categories/payments)

mantraideas/laravel-fonepay
===========================

FonePay Payment Gateway Integration for Laravel

1.0.2(4w ago)014↓50%2MITPHPPHP ^8.1

Since Jun 15Pushed 4w agoCompare

[ Source](https://github.com/MantraIdeas/LaravelFonepay)[ Packagist](https://packagist.org/packages/mantraideas/laravel-fonepay)[ RSS](/packages/mantraideas-laravel-fonepay/feed)WikiDiscussions 1.x Synced 2w ago

READMEChangelog (3)Dependencies (10)Versions (4)Used By (0)

[![Laravel FonePay](https://camo.githubusercontent.com/51bdd278e6ea4d1ae0d5f66d721936514a1f93ea41eef42972d41179e270ee22/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230466f6e655061792e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6d616e74726169646561732532466c61726176656c2d666f6e65706179267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d496e746567726174652b466f6e655061792b7061796d656e742b676174657761792b696e746f2b796f75722b4c61726176656c2b6170706c69636174696f6e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/51bdd278e6ea4d1ae0d5f66d721936514a1f93ea41eef42972d41179e270ee22/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230466f6e655061792e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6d616e74726169646561732532466c61726176656c2d666f6e65706179267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d496e746567726174652b466f6e655061792b7061796d656e742b676174657761792b696e746f2b796f75722b4c61726176656c2b6170706c69636174696f6e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

Laravel FonePay
===============

[](#laravel-fonepay)

[![Latest Stable Version](https://camo.githubusercontent.com/8b4b0234c0a1008c76be8a1e317757445d4378251df9dd54d86717e07a8358c2/687474703a2f2f706f7365722e707567782e6f72672f6d616e74726169646561732f6c61726176656c2d666f6e657061792f76)](https://packagist.org/packages/mantraideas/laravel-fonepay)[![Total Downloads](https://camo.githubusercontent.com/5a6d8a158bedc1330d82355be33e5a1583b7726d53db55b454c30d22be744e81/687474703a2f2f706f7365722e707567782e6f72672f6d616e74726169646561732f6c61726176656c2d666f6e657061792f646f776e6c6f616473)](https://packagist.org/packages/mantraideas/laravel-fonepay)[![License](https://camo.githubusercontent.com/b825a10f2acf388350a51ea1b96c733e26ab268ef6fcf155329561158fc70f65/687474703a2f2f706f7365722e707567782e6f72672f6d616e74726169646561732f6c61726176656c2d666f6e657061792f6c6963656e7365)](https://packagist.org/packages/mantraideas/laravel-fonepay)

The `mantraideas/laravel-fonepay` package allows you to integrate the FonePay payment gateway into your Laravel application. It supports QR code payment generation, bank listing, and payment status verification.

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

[](#requirements)

- PHP ^8.1
- Laravel ^13.0

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

[](#installation)

```
composer require mantraideas/laravel-fonepay
```

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

[](#configuration)

### Publish Config File

[](#publish-config-file)

```
php artisan vendor:publish --provider="Mantraideas\LaravelFonepay\LaravelFonepayServiceProvider"
```

This will create a `config/fonepay.php` file in your Laravel application.

### Environment Variables

[](#environment-variables)

Set the following in your `.env` file:

```
FONEPAY_USERNAME="your_merchant_username"
FONEPAY_PASSWORD="your_merchant_password"
FONEPAY_BASE_URL="https://dev-external-gateway-new.fonepay.com/merchantThirdparty"
FONEPAY_BASE_PATH="/api/merchant/third-party/v2"
FONEPAY_TERMINAL_ID="your_terminal_id"
```

VariableDescription`FONEPAY_USERNAME`Your FonePay merchant username`FONEPAY_PASSWORD`Your FonePay merchant password`FONEPAY_BASE_URL`FonePay API base URL (defaults to development endpoint)`FONEPAY_BASE_PATH`FonePay API base path`FONEPAY_TERMINAL_ID`Your FonePay terminal ID`FONEPAY_PRIVATE_KEY_PATH`Path to your RSA private key file (defaults to `storage_path('keys/private.pem')`)### Private Key

[](#private-key)

Place your RSA private key file in `storage/keys/private.pem` (or configure the path via `FONEPAY_PRIVATE_KEY_PATH`). This key is used to sign API requests.

Usage
-----

[](#usage)

### Generate QR Code for Payment

[](#generate-qr-code-for-payment)

```
use Mantraideas\LaravelFonepay\DTOs\GenerateQrCodeDTO;
use Mantraideas\LaravelFonepay\Facades\Fonepay;

$qrCode = Fonepay::generateQrCode(new GenerateQrCodeDTO(
    amount: 1000.00,
    billId: 'BILL-' . uniqid(),
    terminalId: config('fonepay.terminal_id'),
    paymentMode: 'QR',
    referenceLabel: 'REF-' . uniqid(),
    qrType: 'INTENT_QR',
));

// Response contains:
$qrCode->qrString;       // QR string data
$qrCode->prn;            // Payment reference number
$qrCode->status;         // Status of QR generation
$qrCode->qrDisplayName;  // Display name for the QR
```

> Note: You need to follow guidelines from FonePay to show the QR code to the customer.

#### GenerateQrCodeDTO Parameters

[](#generateqrcodedto-parameters)

ParameterTypeDescription`amount``float`Payment amount`billId``string`Unique bill identifier`terminalId``string`Your FonePay terminal ID`paymentMode``string`Payment mode (e.g. `'QR'`)`referenceLabel``string`Unique reference label for this transaction`qrType``string`QR type (e.g. `'INTENT_QR'`)### Get Payment Status

[](#get-payment-status)

```
use Mantraideas\LaravelFonepay\Facades\Fonepay;

$status = Fonepay::getPaymentStatus('PRN-001');

// Response:
$status->referenceLabel;          // The reference label (PRN)
$status->merchantCode;           // Merchant code
$status->paymentStatus;          // Payment status (e.g. 'COMPLETED')
$status->requestedAmount;        // Requested amount
$status->totalTransactionAmount; // Total transaction amount
$status->paymentMessage;         // Payment message
$status->fonepayTraceId;         // FonePay trace ID (optional)
```

### List Available Banks

[](#list-available-banks)

```
use Mantraideas\LaravelFonepay\Facades\Fonepay;

$banks = Fonepay::getBanks();

foreach ($banks as $bank) {
    $bank->bankName;      // Bank name
    $bank->bankCode;      // Bank code
    $bank->bankIcon;      // Bank icon URL
    $bank->packageName;   // Android package name
    $bank->intentScheme;  // Android intent scheme
}
```

### Using the Facade

[](#using-the-facade)

The `Fonepay` facade is auto-registered by the service provider, so you can use it directly without manually resolving the service:

```
use Mantraideas\LaravelFonepay\Facades\Fonepay;

// Generate QR Code
$qrCode = Fonepay::generateQrCode($dto);

// List Banks
$banks = Fonepay::getBanks();

// Check Payment Status
$status = Fonepay::getPaymentStatus('PRN-001');
```

DTO Reference
-------------

[](#dto-reference)

### `GenerateQrCodeDTO` (Input)

[](#generateqrcodedto-input)

Used with `Fonepay::generateQrCode()`. Construct using named arguments:

```
new GenerateQrCodeDTO(
    amount: float,         // Payment amount
    billId: string,        // Unique bill identifier
    terminalId: string,    // Your FonePay terminal ID
    paymentMode: string,   // e.g. 'QR'
    referenceLabel: string,// Unique reference label per transaction
    qrType: string,        // e.g. 'INTENT_QR'
);
```

PropertyTypeDescription`amount``float`Payment amount`billId``string`Unique bill identifier`terminalId``string`Your FonePay terminal ID`paymentMode``string`Payment mode (e.g. `'QR'`)`referenceLabel``string`Unique reference label for this transaction`qrType``string`QR type (e.g. `'INTENT_QR'`)---

### `QrCodeDTO` (Return)

[](#qrcodedto-return)

Returned by `Fonepay::generateQrCode()`:

PropertyTypeDescription`qrString``string`QR string data`qrDisplayName``string`Display name for the QR`status``string`Status of QR generation`terminalId``int`Terminal ID`prn``string`Payment reference number`qrMessage``string`QR message`terminalName``string`Terminal name`webSocketId``string`WebSocket ID`location``string`Location`fonePayPanNumber``string`FonePay PAN number---

### `StatusDTO` (Return)

[](#statusdto-return)

Returned by `Fonepay::getPaymentStatus()`:

PropertyTypeDescription`referenceLabel``string`The reference label (PRN)`merchantCode``string`Merchant code`paymentStatus``string`Payment status (e.g. `'COMPLETED'`)`requestedAmount``string`Requested amount`totalTransactionAmount``string`Total transaction amount`paymentMessage``string`Payment message`fonepayTraceId``?int`FonePay trace ID (nullable)---

### `BankDTO` (Return)

[](#bankdto-return)

Returned by `Fonepay::getBanks()`:

PropertyTypeDescription`bankName``string`Bank name`bankCode``string`Bank code`bankIcon``string`Bank icon URL`packageName``string`Android package name`intentScheme``string`Android intent schemeExceptions
----------

[](#exceptions)

ExceptionCondition`FonepayDuplicateReferenceLabelException`Duplicate reference label (HTTP 409)`FonepayValidationException`Validation error (HTTP 400)`FonepayInvalidTerminalException`Invalid terminal ID (HTTP 409 on status check)`FonepayInvalidReferenceLabelException`Invalid reference label (HTTP 500 on status check)`FonepayException`Generic API error`InvalidPrivateKeyException`Missing or invalid private keyTesting
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

[MIT](LICENSE)

Author
------

[](#author)

- [@Dipesh79](https://github.com/Dipesh79)

Support
-------

[](#support)

For support, email .

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance94

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~5 days

Total

4

Last Release

29d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/63183800?v=4)[Dipesh Khanal](/maintainers/Dipesh79)[@dipesh79](https://github.com/dipesh79)

![](https://avatars.githubusercontent.com/u/140070190?v=4)[Mantra Ideas Pvt. Ltd.](/maintainers/mantraideasofficial)[@mantraideasofficial](https://github.com/mantraideasofficial)

---

Top Contributors

[![dipesh79](https://avatars.githubusercontent.com/u/63183800?v=4)](https://github.com/dipesh79 "dipesh79 (4 commits)")[![Bishal102](https://avatars.githubusercontent.com/u/116095391?v=4)](https://github.com/Bishal102 "Bishal102 (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mantraideas-laravel-fonepay/health.svg)

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

###  Alternatives

[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3518.3k](/packages/duncanmcclean-statamic-cargo)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k8](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)

PHPackages © 2026

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