PHPackages                             twelver313/kapital-bank - 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. twelver313/kapital-bank

ActiveLibrary[Payment Processing](/categories/payments)

twelver313/kapital-bank
=======================

Kapital Bank E-Commerce 3DS v2.2 Payment Gateway adapter

1.1.1(1y ago)036BSD-3-ClausePHPPHP ^5.6 || ^7.0 || ^8.0

Since Aug 25Pushed 1y agoCompare

[ Source](https://github.com/mansurhamidov14/PHP-Kapital-Bank-3DS-2.2-Payment-Adapter)[ Packagist](https://packagist.org/packages/twelver313/kapital-bank)[ RSS](/packages/twelver313-kapital-bank/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)DependenciesVersions (8)Used By (0)

 [![](https://private-user-images.githubusercontent.com/34154535/379428564-c51c3a01-8a26-4f47-9046-83404509eb95.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU1MDYzOTEsIm5iZiI6MTc3NTUwNjA5MSwicGF0aCI6Ii8zNDE1NDUzNS8zNzk0Mjg1NjQtYzUxYzNhMDEtOGEyNi00ZjQ3LTkwNDYtODM0MDQ1MDllYjk1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA2VDIwMDgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUxNjQ0NDFjMWIyOTk4ZWY4ZTAxZTAwZDE0NTNkYmI0YmE4OWMyNGFjNWRkYTFiMzBmMDI0MjhhNDFiNDc3ZGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.15NUZhDE1QfxVIw32qAFNOVdNIFUy7kExeCRgWPpHU4)](https://private-user-images.githubusercontent.com/34154535/379428564-c51c3a01-8a26-4f47-9046-83404509eb95.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU1MDYzOTEsIm5iZiI6MTc3NTUwNjA5MSwicGF0aCI6Ii8zNDE1NDUzNS8zNzk0Mjg1NjQtYzUxYzNhMDEtOGEyNi00ZjQ3LTkwNDYtODM0MDQ1MDllYjk1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDA2VDIwMDgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUxNjQ0NDFjMWIyOTk4ZWY4ZTAxZTAwZDE0NTNkYmI0YmE4OWMyNGFjNWRkYTFiMzBmMDI0MjhhNDFiNDc3ZGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.15NUZhDE1QfxVIw32qAFNOVdNIFUy7kExeCRgWPpHU4)

Kapital Bank E-Commerce API integration library
===============================================

[](#kapital-bank-e-commerce-api-integration-library)

Seamlessly integrate Kapital Bank E-Commerce API using object-oriented PHP.

Table of Contents
-----------------

[](#table-of-contents)

- [1. Installation](#1-installation)
- [2. Usage](#2-usage)
    - [2.1 Initialize payment gateway adapter](#21-initialize-payment-gateway-adapter)
    - [2.2 Create order](#22-create-order)
    - [2.3 Refunding](#23-refunding)
    - [2.4 Get order status](#24-get-order-status)
    - [2.5 Restore order](#25-restore-order)
    - [2.6 Sending custom requests](#26-sending-custom-requests)

1. Installation
---------------

[](#1-installation)

`composer require twelver313/kapital-bank`

2. Usage
--------

[](#2-usage)

### 2.1 Initialize payment gateway adapter

[](#21-initialize-payment-gateway-adapter)

```
use Twelver313\KapitalBank\PaymentGateway;

$paymentGateway = new PaymentGateway([
  'login' => '',
  'password' => '',
  'isDev' => true, // Optional flag for using Kapital-Bank's test environment
  /* You don't need to pass the option below. It was added just in case Kapital Bank changes host address */
  // 'paymentHost' => 'https://txpgtst.kapitalbank.az'
]);
```

### 2.2 Create order

[](#22-create-order)

```
$orderParams = [
  'amount' => 10, // i.e '10.00',
  'currency' => 'AZN', // Optional, 'AZN' by default
  'description' => 'Purchase order example', // Your description
  'redirectUrl' => '/your-redirect-url',
  'language' => 'az', // Optional, 'az' by default
];
/** Creating purchase order */
$order = $paymentGateway->createPurchaseOrder($orderParams);

/** Creating pre-auth order */
$order = $paymentGateway->createPreAuthOrder($orderParams);

/** Creating recurring order */
$order = $paymentGateway->createRecurringOrder($orderParams);

/** Navigate to payment page  */
$order->navigateToPaymentPage();

/** Or alternatively use other properties to accomplish your tasks */
$order->url;
$order->id;
$order->secret;
$order->password;
```

### 2.3 Refunding

[](#23-refunding)

```
$response = $paymentGateway->refund([
  'id' => ,
  'password' => '',
  'amount' => 10, // i.e 10.00
  'phase' => 'Single', // Optional, 'Single' by default
]);

// Response properties
$response->approvalCode; // Example: "963348"
$response->pmoResultCode; // Example: "1"
$response->match->{$property}; // Read Kapital-Bank's official documentation see possible properties to refer
```

### 2.4 Get order status

[](#24-get-order-status)

```
use Twelver313\KapitalBank\OrderStatus

$orderStatus = $paymentGateway->getOrderStatus([
  'id' => ,
  'password' => ''
]);

// or use
$orderStatus = $paymentGateway->getDetailedOrderStatus([
  'id' => ,
  'password' => ''
]); // for detailed order status

$status = $orderStatus->status;

// Do any stuff depending on status
if ($status == OrderStatus::CANCELED) { // equivalent: $orderStatus->isCanceled()
  ...
}
if ($status == OrderStatus::DECLINED) { // equivalent: $orderStatus->isDeclined()
  ...
}
if ($status == OrderStatus::FULLY_PAID) { // equivalent: $orderStatus->isFullyPaid()
  ...
}
if ($status == OrderStatus::EXPIRED) { // equivalent: $orderStatus->isExpired()
  ...
}
if ($status == OrderStatus::REFUNDED) { // equivalent: $orderStatus->isRefunded()
  ...
}
if ($orderStatus->isOneOf([OrderStatus::CANCELED, OrderStatus::DECLINED])) {
  ...
}
```

### 2.5 Restore order

[](#25-restore-order)

*You can only restore payments with `Preparing` status so we recommend you to check the order status using `PaymentGateway::getOrderStatus()` method to make sure of it before restoring the order*

```
$orderParams = [
  'id' => ,
  'password' => ''
];
$orderStatus = $paymentGateway->getOrderStatus($orderParams);

/** Restoring order if it was not finished or expired */
if ($orderStatus->isPreparing()) {
  $order = $paymentGateway->restoreOrder($orderParams);
  $order->navigateToPaymentPage();
}
```

### 2.6 Sending custom requests

[](#26-sending-custom-requests)

*Since this library doesn't provide all E-Commerce API features you can still perform the operations that are not coming out of the box by sending custom HTTP-requests*

```
$response = $paymentGateway->makeRequest('POST', '/api/order/{id}/set-src-token?password={password}', [
  'order' => [
    'initiationEnvKind' => 'Server'
  ],
  'token' => [
    'extCof'  => [
      'ridByCofp' => '',
      'cofProviderRid' => 'TWO_COF'
    ],
    'card' => [
      'entryMode' => 'ECommerce'
    ]
  ]
]);

print_r($response);
```

*Response will be an instance of `stdClass`. See official BirBank E-commerce API documentation to find out the response structure depending on your request*

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance43

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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 ~28 days

Recently: every ~0 days

Total

7

Last Release

457d ago

Major Versions

0.9.0 → 1.0.0-beta2025-02-06

PHP version history (2 changes)0.9.0PHP &gt;=5.6

1.0.0-betaPHP ^5.6 || ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/20ac65a1b49c1b82d0b15b151ce0180df434a1657d05d02f022defb026315475?d=identicon)[twelver313](/maintainers/twelver313)

---

Top Contributors

[![mansurhamidov14](https://avatars.githubusercontent.com/u/34154535?v=4)](https://github.com/mansurhamidov14 "mansurhamidov14 (27 commits)")

### Embed Badge

![Health badge](/badges/twelver313-kapital-bank/health.svg)

```
[![Health](https://phpackages.com/badges/twelver313-kapital-bank/health.svg)](https://phpackages.com/packages/twelver313-kapital-bank)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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