PHPackages                             tcgunel/omnipay-ahlpay - 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. tcgunel/omnipay-ahlpay

ActiveLibrary[Payment Processing](/categories/payments)

tcgunel/omnipay-ahlpay
======================

Omnipay extension for Ahlpay

v2.0.0(3mo ago)02MITPHPPHP ^8.3CI passing

Since Mar 23Pushed 3mo agoCompare

[ Source](https://github.com/tcgunel/omnipay-ahlpay)[ Packagist](https://packagist.org/packages/tcgunel/omnipay-ahlpay)[ Docs](https://github.com/tcgunel/omnipay-ahlpay)[ RSS](/packages/tcgunel-omnipay-ahlpay/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (8)Versions (3)Used By (0)

Omnipay: Ahlpay
===============

[](#omnipay-ahlpay)

**Ahlpay sanal pos gateway for the Omnipay PHP payment processing library**

[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Ahlpay support for Omnipay.

Ahlpay is a payment institution that uses a JSON-based API with token authentication.

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

[](#installation)

```
composer require tcgunel/omnipay-ahlpay
```

Available Methods
-----------------

[](#available-methods)

MethodDescription`purchase()`Direct (non-3D) sale or 3D Secure redirect`completePurchase()`Query payment status after 3D callback`void()`Cancel/void a transaction`refund()`Refund a transaction (full or partial)Authentication
--------------

[](#authentication)

Ahlpay requires a two-step authentication process:

1. **Obtain a token** by calling the Ahlpay authentication API with your email/password
2. **Use the token** in subsequent payment requests

The token must be obtained outside of this gateway (e.g., via a separate HTTP call to `/api/Security/AuthenticationMerchant`) and passed to the gateway as a parameter.

Usage
-----

[](#usage)

### Gateway Initialization

[](#gateway-initialization)

```
use Omnipay\Omnipay;

$gateway = Omnipay::create('Ahlpay');

$gateway->setMerchantId('100');           // Your member ID
$gateway->setMerchantUser('user@email'); // Login email
$gateway->setMerchantPassword('pass');    // Login password
$gateway->setMerchantStorekey('key');     // Store key for hash
$gateway->setToken('jwt-token');          // Auth token (obtained separately)
$gateway->setTokenType('Bearer');         // Token type
$gateway->setAhlpayMerchantId(5001);      // Ahlpay merchant ID (from token response)
$gateway->setTestMode(true);
```

### Non-3D Purchase (Direct Sale)

[](#non-3d-purchase-direct-sale)

```
$response = $gateway->purchase([
    'amount'      => '100.00',
    'currency'    => 'TRY',
    'transactionId' => 'ORDER-12345',
    'secure'      => false,
    'card'        => [
        'number'      => '4508034508034509',
        'expiryMonth' => '12',
        'expiryYear'  => '2030',
        'cvv'         => '000',
    ],
])->send();

if ($response->isSuccessful()) {
    echo 'Transaction ID: ' . $response->getTransactionReference();
} else {
    echo 'Error: ' . $response->getMessage();
}
```

### 3D Secure Purchase

[](#3d-secure-purchase)

```
$response = $gateway->purchase([
    'amount'      => '100.00',
    'currency'    => 'TRY',
    'transactionId' => 'ORDER-12345',
    'secure'      => true,
    'returnUrl'   => 'https://yoursite.com/payment/success',
    'cancelUrl'   => 'https://yoursite.com/payment/fail',
    'card'        => [
        'number'      => '4508034508034509',
        'expiryMonth' => '12',
        'expiryYear'  => '2030',
        'cvv'         => '000',
    ],
])->send();

if ($response->isRedirect()) {
    // Ahlpay returns HTML content for 3D redirect
    echo $response->getRedirectHtml();
}
```

### Complete 3D Secure Purchase (Callback Handler)

[](#complete-3d-secure-purchase-callback-handler)

After the bank posts back to your `returnUrl`, query the payment status:

```
$response = $gateway->completePurchase([
    'transactionId' => $_POST['orderId'],
    'rnd'           => $_POST['rnd'],  // optional
])->send();

if ($response->isSuccessful()) {
    echo 'Payment confirmed! Transaction: ' . $response->getTransactionReference();
} else {
    echo 'Payment failed: ' . $response->getMessage();
}
```

### Void (Cancel)

[](#void-cancel)

```
$response = $gateway->void([
    'orderNumber' => 'ORDER-12345',
    'currency'    => 'TRY',
])->send();

if ($response->isSuccessful()) {
    echo 'Transaction voided.';
} else {
    echo 'Error: ' . $response->getMessage();
}
```

### Refund

[](#refund)

```
$response = $gateway->refund([
    'orderNumber' => 'ORDER-12345',
    'amount'      => '50.00',
    'currency'    => 'TRY',
])->send();

if ($response->isSuccessful()) {
    echo 'Refund processed.';
} else {
    echo 'Error: ' . $response->getMessage();
}
```

Hash Algorithm
--------------

[](#hash-algorithm)

```
SHA512(StoreKey + Rnd + OrderId + TotalAmount + MerchantId)

```

The hash uses UTF-16LE encoding before SHA512, and the result is uppercase hex.

Endpoints
---------

[](#endpoints)

EnvironmentBase URLTest`https://testahlsanalpos.ahlpay.com.tr`Production`https://ahlsanalpos.ahlpay.com.tr`### API Paths

[](#api-paths)

OperationPathNon-3D Payment`/api/Payment/PaymentNon3D`3D Payment`/api/Payment/Payment3DWithEventRedirect`Payment Inquiry`/api/Payment/PaymentInquiry`Void`/api/Payment/Void`Refund`/api/Payment/Refund`Authentication`/api/Security/AuthenticationMerchant`Running Tests
-------------

[](#running-tests)

```
composer test
```

Static Analysis
---------------

[](#static-analysis)

```
composer analyse
```

Code Style
----------

[](#code-style)

```
composer lint
```

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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

Every ~0 days

Total

2

Last Release

95d ago

Major Versions

v1.0.0 → v2.0.02026-03-23

PHP version history (2 changes)v1.0.0PHP ^8.0

v2.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/36dffe883e88aeef07c26067af3d6a7eda1c2a81f1ae45fdd430b721665131da?d=identicon)[Mobius Studio](/maintainers/Mobius%20Studio)

---

Top Contributors

[![tcgunel](https://avatars.githubusercontent.com/u/3923425?v=4)](https://github.com/tcgunel "tcgunel (5 commits)")

---

Tags

paymentgatewayomnipaysanal-pos3d-secureahlpay

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tcgunel-omnipay-ahlpay/health.svg)

```
[![Health](https://phpackages.com/badges/tcgunel-omnipay-ahlpay/health.svg)](https://phpackages.com/packages/tcgunel-omnipay-ahlpay)
```

###  Alternatives

[yasinkuyu/omnipay-iyzico

Iyzico gateway for Omnipay payment processing library

137.3k](/packages/yasinkuyu-omnipay-iyzico)

PHPackages © 2026

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