PHPackages                             alexminza/maib-mia-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. alexminza/maib-mia-sdk

ActiveLibrary[API Development](/categories/api)

alexminza/maib-mia-sdk
======================

PHP SDK for maib MIA API

v1.1.2(3mo ago)2252GPL-3.0-or-laterPHPPHP &gt;=7.2.5

Since Oct 26Pushed 3mo agoCompare

[ Source](https://github.com/alexminza/maib-mia-sdk-php)[ Packagist](https://packagist.org/packages/alexminza/maib-mia-sdk)[ Docs](https://github.com/alexminza/maib-mia-sdk-php)[ RSS](/packages/alexminza-maib-mia-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (8)Versions (7)Used By (2)

PHP SDK for maib MIA API
========================

[](#php-sdk-for-maib-mia-api)

[![maib MIA](https://repository-images.githubusercontent.com/1076179057/9258aa73-ca53-4f17-9ee4-08b5e068ef47)](https://repository-images.githubusercontent.com/1076179057/9258aa73-ca53-4f17-9ee4-08b5e068ef47)

- maib MIA QR API docs:
- maib Request to Pay (RTP) API docs:
- GitHub project
- Composer package

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

[](#installation)

To easily install or upgrade to the latest release, use `composer`:

```
composer require alexminza/maib-mia-sdk
```

To enable logging add the `monolog` package:

```
composer require monolog/monolog
```

Getting started
---------------

[](#getting-started)

Import SDK:

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

use Maib\MaibMia\MaibMiaClient;
```

Add project configuration:

```
$DEBUG = getenv('DEBUG');

$MAIB_MIA_BASE_URI = getenv('MAIB_MIA_BASE_URI');
$MAIB_MIA_CLIENT_ID = getenv('MAIB_MIA_CLIENT_ID');
$MAIB_MIA_CLIENT_SECRET = getenv('MAIB_MIA_CLIENT_SECRET');
$MAIB_MIA_SIGNATURE_KEY = getenv('MAIB_MIA_SIGNATURE_KEY');
```

Initialize client:

```
$options = [
    'base_uri' => $MAIB_MIA_BASE_URI,
    'timeout' => 30
];

if ($DEBUG) {
    $logName = 'maib_mia_guzzle';
    $logFileName = "$logName.log";

    $log = new \Monolog\Logger($logName);
    $log->pushHandler(new \Monolog\Handler\StreamHandler($logFileName, \Monolog\Logger::DEBUG));

    $stack = \GuzzleHttp\HandlerStack::create();
    $stack->push(\GuzzleHttp\Middleware::log($log, new \GuzzleHttp\MessageFormatter(\GuzzleHttp\MessageFormatter::DEBUG)));

    $options['handler'] = $stack;
}

$guzzleClient = new \GuzzleHttp\Client($options);
$maibMiaClient = new MaibMiaClient($guzzleClient);
```

SDK usage examples
------------------

[](#sdk-usage-examples)

### Get Access Token with Client ID and Client Secret

[](#get-access-token-with-client-id-and-client-secret)

```
$tokenResponse = $maibMiaClient->getToken($MAIB_MIA_CLIENT_ID, $MAIB_MIA_CLIENT_SECRET);
$accessToken = $tokenResponse['result']['accessToken'];
```

### Create a dynamic order payment QR

[](#create-a-dynamic-order-payment-qr)

```
$validityMinutes = 60;
$expiresAt = (new DateTime())->modify("+{$validityMinutes} minutes")->format('c');

$qrData = [
    'type' => 'Dynamic',
    'expiresAt' => $expiresAt,
    'amountType' => 'Fixed',
    'amount' => 50.00,
    'currency' => 'MDL',
    'description' => 'Order #123',
    'orderId' => '123',
    'callbackUrl' => 'https://example.com/callback',
    'redirectUrl' => 'https://example.com/success'
];

$qrCreateResponse = $maibMiaClient->qrCreate($qrData, $accessToken);
```

### Validate callback signature

[](#validate-callback-signature)

```
$callbackBody = '{
    "result": {
        "qrId": "c3108b2f-6c2e-43a2-bdea-123456789012",
        "extensionId": "3fe7f013-23a6-4d09-a4a4-123456789012",
        "qrStatus": "Paid",
        "payId": "eb361f48-bb39-45e2-950b-123456789012",
        "referenceId": "MIA0001234567",
        "orderId": "123",
        "amount": 50.00,
        "commission": 0.1,
        "currency": "MDL",
        "payerName": "TEST QR PAYMENT",
        "payerIban": "MD88AG000000011621810140",
        "executedAt": "2025-04-18T14:04:11.81145+00:00",
        "terminalId": null
    },
    "signature": "fHM+l4L1ycFWZDRTh/Vr8oybq1Q1xySdjyvmFQCmZ4s="
}';

$callbackData = json_decode($callbackBody, true);
$validationResult = MaibMiaClient::validateCallbackSignature($callbackData, $MAIB_MIA_SIGNATURE_KEY);
```

### Perform a test QR payment

[](#perform-a-test-qr-payment)

```
$qrId = $qrCreateResponse['result']['qrId'];
$testPayData = [
    'qrId' => $qrId,
    'amount' => 50.00,
    'iban' => 'MD88AG000000011621810140',
    'currency' => 'MDL',
    'payerName' => 'TEST QR PAYMENT'
];

$testPayResponse = $maibMiaClient->testPay($testPayData, $accessToken);
```

### Get payment details

[](#get-payment-details)

```
$payId = $testPayResponse['result']['payId'];
$paymentDetailsResponse = $maibMiaClient->paymentDetails($payId, $accessToken);
```

### Refund payment

[](#refund-payment)

```
$refundData = [
    'reason' => 'Test refund reason',
    // 'amount' => 25.00, // Optional: for partial refund
    // 'callbackUrl' => 'https://example.com/refund' // Optional
];

$paymentRefundResponse = $maibMiaClient->paymentRefund($payId, $refundData, $accessToken);
```

### Create a Request to Pay (RTP)

[](#create-a-request-to-pay-rtp)

```
$validityMinutes = 60;
$expiresAt = (new DateTime())->modify("+{$validityMinutes} minutes")->format('c');

$rtpData = [
    'alias' => '3736xxxxxxx',
    'amount' => 150.00,
    'expiresAt' => $expiresAt,
    'currency' => 'MDL',
    'description' => 'Invoice #123',
    'orderId' => '123',
    'terminalId' => 'P011111',
    'callbackUrl' => 'https://example.com/callback',
    'redirectUrl' => 'https://example.com/success'
];

$rtpCreateResponse = $maibMiaClient->rtpCreate($rtpData, $accessToken);
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance81

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity34

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

Every ~19 days

Total

6

Last Release

99d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8621365c2c0997e317ce43bf4211caf5ca443d487052f5e4e024ca4d297ac6ba?d=identicon)[alexminza](/maintainers/alexminza)

---

Top Contributors

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

---

Tags

apimaibmiamoldovapayment-gatewaypayment-integrationpaymentsphpqrrtpsdkqrapisdkpaymentsmaibMoldovamia

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/alexminza-maib-mia-sdk/health.svg)

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

###  Alternatives

[transbank/transbank-sdk

Transbank SDK

62626.4k12](/packages/transbank-transbank-sdk)[invoiced/invoiced

Invoiced PHP Library

14117.1k](/packages/invoiced-invoiced)

PHPackages © 2026

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