PHPackages                             fahipay/gateway - 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. fahipay/gateway

ActiveLibrary[Payment Processing](/categories/payments)

fahipay/gateway
===============

FahiPay payment gateway client

v1.0.0(1y ago)038MITPHP

Since Oct 24Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

FahiPay Payment Gateway Client
==============================

[](#fahipay-payment-gateway-client)

The FahiPay Payment Gateway Client is a PHP library that provides an interface to interact with the FahiPay payment gateway API. It allows you to easily create transactions and query specific transactions using the API provided by FahiPay.

Features
--------

[](#features)

- Create transactions with ease using the API provided by FahiPay.
- Query specific transactions by transaction ID.
- Automatically calculates and generates the required digital signature.
- Validate signature in response.

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

[](#installation)

You can install the FahiPay Gateway Client using Composer:

```
composer require fahipay/gateway
```

Usage
-----

[](#usage)

### Creating a Transaction

[](#creating-a-transaction)

To create a transaction, initialize the FPG (FahiPay Payment Gateway) client with your FahiPay credentials and URLs, and then call the `createTransaction` method. You can obtain credentials from

Here's an example:

```
$merchantId     = 'your_merchant_id';
$secretKey      = 'your_secret_key';
$returnUrl      = 'https://example.com/success';
$returnErrorUrl = 'https://example.com/error';
$cancelUrl      = 'https://example.com/cancel';

$apiClient      = new FahiPay\Gateway($merchantId, $secretKey, $returnUrl, $returnErrorUrl, $cancelUrl);
$response       = $apiClient->createTransaction('TXN001', 10.03); // Unique transaction id, Amount in MVR (2dp)
print_r($response);
/*
{
  "type": "success",
  "link": "https://fahipay.mv/pay/L2XXXXXXXXXXXXXXXXXX"
}
*/
```

### Querying a Specific Transaction

[](#querying-a-specific-transaction)

To query a specific transaction, provide the transaction ID to the `getTransaction` method. Here's an example:

```
$transactionId = 'TXN001'; // Replace with the actual transaction ID
$queryResponse = $apiClient->getTransaction($transactionId);

print_r($queryResponse);
/*
{
  "type": "success",
  "data": {
    "time": "2023-08-15 21:29:05",
    "method": "gateway",
    "mref": "TXN001",
    "amount": 10.03,
    "fee": 0.0,
    "link": "https://fahipay.mv/pay/L2XXXXXXXXXXXXXXXXXX",
    "extras": null,
    "status": "pending",
    "ApprovalCode": null
  }
}
*/
```

### Validating signature

[](#validating-signature)

To validate signature received from FahiPay, provide signature, transactionId, success (status) and approvalCode received from FahiPay, to the `validateSignature` method. Here's an example:

```
$success          = $_GET['Success'];
$transactionId    = $_GET['ShoppingCartID'];
$approvalCode     = $_GET['ApprovalCode'];
$signature        = $_GET['Signature'];
$isValidSignature = $apiClient->validateSignature($success,$transactionId,$approvalCode,$signature);

print_r($isValidSignature); //returns true or false
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

571d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/883c1a68dbf3c61c618d2f6cdc75762685cb788ce1af6bb379416609b513e0c0?d=identicon)[FahiPay](/maintainers/FahiPay)

---

Top Contributors

[![fahipay](https://avatars.githubusercontent.com/u/29014305?v=4)](https://github.com/fahipay "fahipay (20 commits)")

---

Tags

paymentgatewaypayunifiedmaldivesdhivehifpgfahipayfahi

### Embed Badge

![Health badge](/badges/fahipay-gateway/health.svg)

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

###  Alternatives

[lokielse/omnipay-alipay

Alipay gateway for Omnipay payment processing library

587421.0k11](/packages/lokielse-omnipay-alipay)[sudiptpa/omnipay-nabtransact

National Australia Bank (NAB) Transact driver for the Omnipay payment processing library.

1017.2k](/packages/sudiptpa-omnipay-nabtransact)[lucassmacedo/omnipay-mercadopago

MercadoPago gateway for OmniPay

154.6k](/packages/lucassmacedo-omnipay-mercadopago)

PHPackages © 2026

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