PHPackages                             elnurxf/omnipay-azericard - 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. elnurxf/omnipay-azericard

ActiveLibrary

elnurxf/omnipay-azericard
=========================

AzeriCard e-commerce gateway for Omnipay payment processing library

06PHP

Since Jul 7Pushed 10mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Omnipay: AzeriCard
==================

[](#omnipay-azericard)

**AzeriCard gateway for [Omnipay](https://github.com/thephpleague/omnipay)**

This package provides AzeriCard e-commerce gateway integration with support for 3D Secure, refunds, and signature verification.

> Built and maintained by [Elnur Akhundov](mailto:elnurxf@gmail.com)

---

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

[](#installation)

Install via Composer:

```
composer require elnurxf/omnipay-azericard
```

---

Usage Examples
--------------

[](#usage-examples)

### 1. Purchase Request (3D Redirect Flow)

[](#1-purchase-request-3d-redirect-flow)

```
use Omnipay\Omnipay;

$gateway = Omnipay::create('AzeriCard');
$gateway->setTerminalId('YOUR_TERMINAL_ID');
$gateway->setPrivateKeyPath(storage_path('keys/private.pem')); // PEM file
$gateway->setTestMode(true); // or false for production

$response = $gateway->purchase([
    'amount'         => '20.00',
    'currency'       => 'AZN',
    'transactionId'  => '12345',
    'returnUrl'      => route('payment.callback'),
    'description'    => 'Order #12345',
    'email'          => 'customer@example.com',
    'name'           => 'John Doe',
])->send();

if ($response->isRedirect()) {
    $response->redirect(); // POST to AzeriCard
} else {
    echo "Error: " . $response->getMessage();
}
```

---

### 2. Authorization (Pre-Auth) Request

[](#2-authorization-pre-auth-request)

```
// Step 1: Create authorization request
$response = $gateway->authorize([
    'amount'         => '50.00',
    'currency'       => 'AZN',
    'transactionId'  => 'AUTH12345',
    'returnUrl'      => route('payment.auth.callback'),
    'description'    => 'Authorization for Order #12345',
    'email'          => 'customer@example.com',
    'name'           => 'John Doe',
])->send();

if ($response->isRedirect()) {
    $response->redirect(); // Redirect to AzeriCard for 3D Secure
} else {
    echo "Authorization Error: " . $response->getMessage();
}
```

> **Note**: Authorization requests now support all standard parameters and properly handle 3D Secure redirects just like purchase requests.

---

### 3. Callback Handler (Complete Purchase/Authorization)

[](#3-callback-handler-complete-purchaseauthorization)

```
$gateway = Omnipay::create('AzeriCard');
$gateway->setPublicKeyPath(storage_path('keys/azericard-public.pem'));

$response = $gateway->completePurchase()->send();

if ($response->isSuccessful()) {
    $reference = $response->getTransactionReference(); // INT_REF
    $rrn = $response->getRRN(); // Retrieval Reference Number
    $amount = $response->getAmount();
    $action = $response->getAction(); // '0' for success

    // For purchase transactions
    if ($response->getTransactionType() === '1') {
        // Mark order as paid
        echo "Payment successful! Reference: {$reference}, RRN: {$rrn}";
    }

    // For authorization transactions
    if ($response->getTransactionType() === '0') {
        // Authorization successful - funds are reserved
        echo "Authorization successful! Reference: {$reference}, RRN: {$rrn}";
        // Store these values for later capture
    }
} else {
    echo "Transaction failed: " . $response->getMessage();
}
```

---

### 4. Capture (Complete Sale) - Complete Pre-Authorized Transaction

[](#4-capture-complete-sale---complete-pre-authorized-transaction)

```
// Step 2: Capture the authorized amount (must be done after successful authorization)
$response = $gateway->completeSale([
    'amount'        => '50.00', // Can be less than or equal to authorized amount
    'currency'      => 'AZN',
    'transactionId' => 'AUTH12345', // Original authorization transaction ID
    'rrn'           => '317276406077', // RRN from authorization callback
    'INT_REF'        => 'ABC123XYZ987', // INT_REF from authorization callback
])->send();

if ($response->isSuccessful()) {
    echo "Capture successful! Funds have been charged.";
    $captureReference = $response->getTransactionReference();
} else {
    echo "Capture failed: " . $response->getMessage();
}
```

---

### 5. Refund

[](#5-refund)

```
$response = $gateway->refund([
    'amount'        => '10.00', // Refund amount (can be partial)
    'currency'      => 'AZN',
    'transactionId' => '12345', // Original transaction ID
    'rrn'           => '317276406077', // RRN from original transaction
    'INT_REF'        => 'ABC123XYZ987', // INT_REF from original transaction
])->send();

if ($response->isSuccessful()) {
    echo "Refund successful!";
    $refundReference = $response->getTransactionReference();
} else {
    echo "Refund failed: " . $response->getMessage();
}
```

---

### 6. Void (Cancel Authorization)

[](#6-void-cancel-authorization)

```
// Cancel/void an authorization before it's captured
$response = $gateway->void([
    'transactionId' => 'AUTH12345', // Original authorization transaction ID
    'rrn'           => '317276406077', // RRN from authorization
    'INT_REF'        => 'ABC123XYZ987', // INT_REF from authorization
])->send();

if ($response->isSuccessful()) {
    echo "Authorization voided successfully!";
} else {
    echo "Void failed: " . $response->getMessage();
}
```

---

### 7. Transaction Status Check

[](#7-transaction-status-check)

```
$response = $gateway->status([
    'transactionId' => '12345',
    'rrn'           => '317276406077',
    'INT_REF'        => 'ABC123XYZ987',
])->send();

if ($response->isSuccessful()) {
    $status = $response->getStatus();
    $amount = $response->getAmount();
    echo "Transaction Status: {$status}, Amount: {$amount}";
} else {
    echo "Status check failed: " . $response->getMessage();
}
```

---

### 8. Complete Payment Flow Example

[](#8-complete-payment-flow-example)

```
// Step 1: Authorization
$authResponse = $gateway->authorize([
    'amount' => '100.00',
    'transactionId' => '12345',
    'returnUrl' => route('auth.callback'),
    // ... other parameters
])->send();

// Step 2: Handle authorization callback
$callbackResponse = $gateway->completePurchase()->send();
if ($callbackResponse->isSuccessful()) {
    $rrn = $callbackResponse->getRRN();
    $INT_REF = $callbackResponse->getTransactionReference();

    // Step 3a: Capture the full amount
    $captureResponse = $gateway->completeSale([
        'amount' => '100.00',
        'transactionId' => '12345',
        'rrn' => $rrn,
        'INT_REF' => $INT_REF,
    ])->send();

    // OR Step 3b: Void the authorization
    $voidResponse = $gateway->void([
        'transactionId' => '12345',
        'rrn' => $rrn,
        'INT_REF' => $INT_REF,
    ])->send();
}
```

---

Security
--------

[](#security)

The gateway signs and verifies all transactions using **RSA-SHA256**. Make sure to:

- Keep your **private key** secure and readable only by your application.
- Use the **public key** provided by AzeriCard to verify callbacks.

---

Roadmap / TODO
--------------

[](#roadmap--todo)

- Purchase (TRTYPE 1) - Direct payment with 3D Secure
- Authorization/Pre-Auth (TRTYPE 0) - Reserve funds with 3D Secure
- Sales completion/Capture (TRTYPE 21) - Capture pre-authorized funds
- Refund (TRTYPE 22) - Full and partial refunds
- Status check (TRTYPE 90) - Transaction status inquiry
- Void authorization (TRTYPE 24) - Cancel pre-authorization
- Verify P\_SIGN signatures - RSA-SHA256 signature verification
- Complete authorization workflow - Pre-auth → 3D Secure → Capture/Void
- Tokenization support
- Recurring payments
- Multi-currency support enhancement

---

License
-------

[](#license)

MIT © [Elnur Akhundov](mailto:elnurxf@gmail.com)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fd888a96585948e2da8eac98cdb5aef9ff495b00ec922376ce95051692543b9?d=identicon)[elnurxf](/maintainers/elnurxf)

---

Top Contributors

[![elnurxf](https://avatars.githubusercontent.com/u/2572412?v=4)](https://github.com/elnurxf "elnurxf (26 commits)")

### Embed Badge

![Health badge](/badges/elnurxf-omnipay-azericard/health.svg)

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

PHPackages © 2026

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