Docs · Plugins & SDKs

PHP SDK

Composer-installable PHP SDK that wraps the E-comm API. Twenty lines from include to first payment.

AudienceDeveloper
DifficultyBasic
Updated2026-05-30

Overview

Open-source PHP SDK that wraps the miaPOS E-comm API end-to-end — token, pay, callback verification, public-key fetch. Source on GitHub: finergy-tech/mia-pay-ecomm-php-sdk.

Install

composer require miapos/ecomm-php-sdk

Or clone the repo for the latest main: github.com/finergy-tech/mia-pay-ecomm-php-sdk.

Usage

use MiaPos\Ecomm\Client;

$client = new Client([
    'merchantId' => 'M12345',
    'secretKey'  => getenv('MIAPOS_SECRET'),
    'terminalId' => 'T0001',
    'baseUrl'    => 'https://ecomm.miapos.md',
]);

$payment = $client->createPayment([
    'orderId'     => 'ORD-001',
    'amount'      => 100.00,
    'currency'    => 'MDL',
    'successUrl'  => 'https://shop.example.md/ok',
    'failUrl'     => 'https://shop.example.md/no',
    'callbackUrl' => 'https://shop.example.md/cb',
]);

header('Location: ' . $payment->checkoutPage);

Verifying callbacks

$verified = $client->verifyCallback(
    file_get_contents('php://input'),
    $_SERVER['HTTP_X_MIAPOS_SIGNATURE']
);
if (!$verified) { http_response_code(400); exit; }

Reference