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

ActiveLibrary[API Development](/categories/api)

alexminza/maib-checkout-sdk
===========================

PHP SDK for maib e-Commerce Checkout API

v1.0.5(4mo ago)33481GPL-3.0-or-laterPHPPHP &gt;=7.2.5

Since Dec 31Pushed 4mo agoCompare

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

READMEChangelog (6)Dependencies (9)Versions (7)Used By (1)

PHP SDK for maib e-Commerce Checkout API
========================================

[](#php-sdk-for-maib-e-commerce-checkout-api)

[![maib e-Commerce Checkout](https://repository-images.githubusercontent.com/1125238716/a3cef907-c160-4575-9339-0cce7c89f295)](https://repository-images.githubusercontent.com/1125238716/a3cef907-c160-4575-9339-0cce7c89f295)

- maib e-Commerce Checkout API docs:
- GitHub project
- Composer package

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

[](#installation)

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

```
composer require alexminza/maib-checkout-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\MaibCheckout\MaibCheckoutClient;
```

Add project configuration:

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

$MAIB_CHECKOUT_BASE_URI = getenv('MAIB_CHECKOUT_BASE_URI');
$MAIB_CHECKOUT_CLIENT_ID = getenv('MAIB_CHECKOUT_CLIENT_ID');
$MAIB_CHECKOUT_CLIENT_SECRET = getenv('MAIB_CHECKOUT_CLIENT_SECRET');
$MAIB_CHECKOUT_SIGNATURE_KEY = getenv('MAIB_CHECKOUT_SIGNATURE_KEY');
```

Initialize client:

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

if ($DEBUG) {
    $logName = 'maib_checkout_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);
$maibCheckoutClient = new MaibCheckoutClient($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 = $maibCheckoutClient->getToken($MAIB_CHECKOUT_CLIENT_ID, $MAIB_CHECKOUT_CLIENT_SECRET);
$accessToken = $tokenResponse['result']['accessToken'];
```

### Register a new hosted checkout session

[](#register-a-new-hosted-checkout-session)

```
$checkoutData = [
    'amount' => 50.61,
    'currency' => 'MDL',
    'orderInfo' => [
        'id' => 'EK123123BV',
        'description' => 'Order description',
        'date' => '2025-11-03T09:28:40.814748+00:00',
        'orderAmount' => null,
        'orderCurrency' => null,
        'deliveryAmount' => null,
        'deliveryCurrency' => null,
        'items' => [
            [
                'externalId' => '243345345',
                'title' => 'Product1',
                'amount' => 50.61,
                'currency' => 'MDL',
                'quantity' => 3,
                'displayOrder' => null,
            ],
            [
                'externalId' => '54353453',
                'title' => 'Product2',
                'amount' => 50.61,
                'currency' => 'MDL',
                'quantity' => 2,
                'displayOrder' => null,
            ],
        ],
    ],
    'payerInfo' => [
        'name' => 'John D.',
        'email' => 'test@gmail.com',
        'phone' => '+37377382716',
        'ip' => '192.168.172.22',
        'userAgent' => 'Mozilla/5.0',
    ],
    'language' => 'ro',
    'callbackUrl' => 'https://example.com/path',
    'successUrl' => 'https://example.com/path',
    'failUrl' => 'https://example.com/path',
];

$checkoutRegisterResponse = $maibCheckoutClient->checkoutRegister($checkoutData, $accessToken);
$checkoutUrl = $checkoutRegisterResponse['result']['checkoutUrl'];
```

### Validate callback signature

[](#validate-callback-signature)

```
// https://docs.maibmerchants.md/checkout/api-reference/callback-notifications#signature-example
$callbackBody = '{"checkoutId":"5a4d27a4-79f5-426b-9403-cccdeee81747","paymentIntentId":"baa2a48d-b3ba-48b8-917e-07607d447c4f","merchantId":"37e48a96-37d7-49b3-8373-2e7e69ef8c2e","terminalId":"23456543","amount":193.54,"currency":"MDL","completedAt":"2024-11-23T19:35:00.6772285+02:00","payerName":"John","payerEmail":"Smith","payerPhone":"37368473653","payerIp":"192.175.12.22","orderId":"1142353","orderDescription":"OrderDescriptiondda760d7-a318-451b-8e47-f3377c06dcf5","orderDeliveryAmount":92.65,"orderDeliveryCurrency":8,"paymentId":"379b31a3-8283-43d4-8a7b-eef8c0736a32","paymentAmount":64.76,"paymentCurrency":"MDL","paymentStatus":"Executed","paymentExecutedAt":"2025-05-05T23:38:07.2760698+03:00","providerType":"Ips","senderIban":"NL43RABO1438227787","senderName":"Steven","senderCardNumber":"444433******1111","retrievalReferenceNumber":"ABC324353245"}';

$signatureHeader = 'sha256=h7/NNr0+SVwqfc1seJNl/m4M4/wzBiZwKHjE1gbmMKA=';
$signatureTimestamp = '1761032516817';
$signatureKey = '67be8e54-ac28-485d-9369-27f6d3c55a27';

$validationResult = MaibCheckoutClient::validateCallbackSignature($callbackBody, $signatureHeader, $signatureTimestamp, $signatureKey);
```

### Get checkout details

[](#get-checkout-details)

```
$checkoutId = $checkoutRegisterResponse['result']['checkoutId'];
$checkoutDetailsResponse = $maibCheckoutClient->checkoutDetails($checkoutId, $accessToken);
```

### Refund payment

[](#refund-payment)

```
$callbackData = json_decode($callbackBody, true);
$paymentId = $callbackData['paymentId'];

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

$paymentRefundResponse = $maibCheckoutClient->paymentRefund($paymentId, $refundData, $accessToken);
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance75

Regular maintenance activity

Popularity19

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

Recently: every ~5 days

Total

6

Last Release

136d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/149919?v=4)[Alexander Minza](/maintainers/alexminza)[@alexminza](https://github.com/alexminza)

---

Top Contributors

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

---

Tags

apimaibmoldovapayment-gatewaypayment-integrationpaymentsphpsdkapisdkpaymentse-commercecheckoutmaibMoldova

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M13](/packages/checkout-checkout-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

617.2M43](/packages/resend-resend-php)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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