PHPackages                             finergy/mia-pos-sdk - 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. [API Development](/categories/api)
4. /
5. finergy/mia-pos-sdk

ActiveLibrary[API Development](/categories/api)

finergy/mia-pos-sdk
===================

PHP SDK for Mia POS ecommerce API

1.0.0(1y ago)010MITPHPPHP &gt;=5.6.0

Since Dec 19Pushed 1y ago2 watchersCompare

[ Source](https://github.com/finergy-tech/mia-pay-ecomm-php-sdk)[ Packagist](https://packagist.org/packages/finergy/mia-pos-sdk)[ Docs](https://github.com/finergy-tech/mia-pay-ecomm-php-sdk.git)[ RSS](/packages/finergy-mia-pos-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

MIA POS PHP SDK
===============

[](#mia-pos-php-sdk)

MIA POS, provided by Finergy Tech, allows secure payment processing using QR codes and direct payment requests.

This SDK allows merchants to integrate with the MIA POS ecommerce payment system. It simplifies the process of registering payments, retrieving payment statuses, and verifying signatures for callbacks. The SDK is designed to be lightweight and compatible with PHP applications.

---

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

[](#requirements)

- PHP version: **&gt;= 5.6**
- PHP Extensions:
    - `curl`
    - `json`

Ensure that these extensions are enabled in your PHP configuration (`php.ini`).

---

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

[](#installation)

### Using Composer

[](#using-composer)

1. Run the following command to add the SDK to your project:

    ```
    composer require finergy/mia-pos-sdk
    ```
2. Include the Composer autoloader in your project:

    ```
    require_once __DIR__ . '/vendor/autoload.php';
    ```

### Manual Installation

[](#manual-installation)

1. Download or clone this repository.
2. Add the `src` folder to your project directory.
3. Include the SDK files manually: ```
    require_once __DIR__ . '/path-to-sdk/src/MiaPosSdk.php';
    require_once __DIR__ . '/path-to-sdk/src/Exceptions/ValidationException.php';
    require_once __DIR__ . '/path-to-sdk/src/Exceptions/ClientApiException.php';
    ```

---

Getting Started
---------------

[](#getting-started)

### Obtaining API Credentials

[](#obtaining-api-credentials)

To use the MIA POS ecommerce system, you must obtain the following credentials from the bank:

- `baseUrl` (API Endpoint)
- `merchantId` (Merchant Identifier)
- `secretKey` (Authentication Key)

All integrations must first be tested on the **test environment** provided by the bank.

---

Usage Flow
----------

[](#usage-flow)

### 1. Registering a Payment

[](#1-registering-a-payment)

When a client chooses to pay via MIA POS on your website, you must register the payment with the MIA POS system.

- **Input**: Payment data (e.g., amount, currency, orderId).
- **Output**: A `paymentId` and a `checkoutPage` URL for redirecting the client to confirm the payment.

Example:

```
require_once __DIR__ . '/src/MiaPosSdk.php';

use Finergy\MiaPosSdk\MiaPosSdk;

$baseUrl = 'https://ecomm-test.miapos.md/';
$merchantId = 'your_merchant_id';
$secretKey = 'your_secret_key';

$sdk = MiaPosSdk::getInstance($baseUrl, $merchantId, $secretKey);

$paymentData = [
    'terminalId' => 'TE0001',
    'orderId' => 'order12345',
    'amount' => 150.75,
    'currency' => 'MDL',
    'language' => 'ro',
    'payDescription' => 'Payment for order #12345',
    'callbackUrl' => 'http://your_callback_url',
    'successUrl' => 'http://your_success_url',
    'failUrl' => 'http://your_fail_url',
];

$response = $sdk->createPayment($paymentData);

$paymentId = $response['paymentId'];
$checkoutPage = $response['checkoutPage'];

// Save $paymentId in your database and redirect the client to $checkoutPage
header("Location: $checkoutPage");
```

---

### 2. Handling Payment Failure (failUrl)

[](#2-handling-payment-failure-failurl)

When the payment fails, the client will be redirected to the `failUrl` specified during payment registration. The request parameters will include the same data passed during the payment registration, such as the `orderId`.

Use the `orderId` to retrieve the corresponding `paymentId` from your database, and then use the SDK to check the payment status. Based on the status, display the appropriate message to the client.

Example:

```
require_once __DIR__ . '/src/MiaPosSdk.php';

use Finergy\MiaPosSdk\MiaPosSdk;

$baseUrl = 'https://ecomm-test.miapos.md/';
$merchantId = 'your_merchant_id';
$secretKey = 'your_secret_key';

$sdk = MiaPosSdk::getInstance($baseUrl, $merchantId, $secretKey);

// Retrieve orderId from the request parameters
$orderId = $_GET['orderId'];

// Fetch paymentId from your database using orderId
$paymentId = getPaymentIdFromDatabase($orderId);

$response = $sdk->getPaymentStatus($paymentId);

if ($response['status'] === 'FAILED') {
    echo "Payment failed. Please try again.";
} else {
    echo "Payment successful!";
    // Update order status in your database
}
```

---

### 3. Handling Payment Success (successUrl)

[](#3-handling-payment-success-successurl)

When the payment succeeds, the client will be redirected to the `successUrl`. The request parameters will include the same data passed during the payment registration, such as the `orderId`.

Use the `orderId` to retrieve the corresponding `paymentId` from your database, and then use the SDK to verify the payment status.

Example:

```
require_once __DIR__ . '/src/MiaPosSdk.php';

use Finergy\MiaPosSdk\MiaPosSdk;

$baseUrl = 'https://ecomm-test.miapos.md/';
$merchantId = 'your_merchant_id';
$secretKey = 'your_secret_key';

$sdk = MiaPosSdk::getInstance($baseUrl, $merchantId, $secretKey);

// Retrieve orderId from the request parameters
$orderId = $_GET['orderId'];

// Fetch paymentId from your database using orderId
$paymentId = getPaymentIdFromDatabase($orderId);

$response = $sdk->getPaymentStatus($paymentId);

if ($response['status'] === 'SUCCESS') {
    echo "Payment successful! Order ID: " . $response['orderId'];
    // Update order status in your database
} else {
    echo "Payment could not be verified. Please contact support.";
}
```

---

### 4. Handling Callbacks (callbackUrl)

[](#4-handling-callbacks-callbackurl)

After the payment is finalized, the MIA POS system will send a signed callback to the `callbackUrl`. Use the SDK to verify the signature and process the callback data.

Example:

```
require_once __DIR__ . '/src/MiaPosSdk.php';

use Finergy\MiaPosSdk\MiaPosSdk;

$baseUrl = 'https://ecomm-test.miapos.md/';
$merchantId = 'your_merchant_id';
$secretKey = 'your_secret_key';

$sdk = MiaPosSdk::getInstance($baseUrl, $merchantId, $secretKey);

// Retrieve callback data (replace with actual input)
$inputJson = file_get_contents('php://input');
$callbackData = json_decode($inputJson, true);

$result = $callbackData['result'];
$signature = $callbackData['signature'];

$signString = $sdk->formSignStringByResult($result);
$isValidSignature = $sdk->verifySignature($signString, $signature);

if ($isValidSignature) {
    echo "Callback verified successfully!";
    // Update order status in your database based on $result['status']
} else {
    echo "Invalid callback signature!";
}
```

---

Notes
-----

[](#notes)

1. Always test your integration in the **test environment** before going live.
2. Ensure secure storage of your API credentials (`merchantId`, `secretKey`) and do not expose them in client-side code.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance40

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

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

509d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75b2ae10eed12d9e32df516648b7e51e128a6e66fd53f1b46228c459a203b9c0?d=identicon)[finergy-tech](/maintainers/finergy-tech)

---

Top Contributors

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

---

Tags

phpapisdkpaymentsecommercemia-pos

### Embed Badge

![Health badge](/badges/finergy-mia-pos-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/finergy-mia-pos-sdk/health.svg)](https://phpackages.com/packages/finergy-mia-pos-sdk)
```

###  Alternatives

[transbank/transbank-sdk

Transbank SDK

62626.4k12](/packages/transbank-transbank-sdk)[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

13998.4k2](/packages/jstolpe-instagram-graph-api-php-sdk)[clever/clever-php

231.6k](/packages/clever-clever-php)

PHPackages © 2026

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