npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

maib-mia-sdk

v1.0.3

Published

Node.js SDK for maib MIA API

Downloads

50

Readme

Node.js SDK for maib MIA API

maib MIA

  • maib MIA QR API docs: https://docs.maibmerchants.md/mia-qr-api
  • maib Request to Pay (RTP) API docs: https://docs.maibmerchants.md/request-to-pay
  • GitHub project https://github.com/alexminza/maib-mia-sdk-node
  • NPM package https://www.npmjs.com/package/maib-mia-sdk

Installation

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

npm install maib-mia-sdk

Getting started

Import SDK:

const {
    MaibMiaSdk,
    MaibMiaApiRequest
} = require('maib-mia-sdk');

Add project configuration:

const MAIB_MIA_CLIENT_ID = process.env.MAIB_MIA_CLIENT_ID;
const MAIB_MIA_CLIENT_SECRET = process.env.MAIB_MIA_CLIENT_SECRET;
const MAIB_MIA_SIGNATURE_KEY = process.env.MAIB_MIA_SIGNATURE_KEY;

SDK usage examples

Get Access Token with Client ID and Client Secret

const maibMiaApiRequest = MaibMiaApiRequest.create(MaibMiaSdk.SANDBOX_BASE_URL);
const maibMiaAuth = await maibMiaApiRequest.generateToken(MAIB_MIA_CLIENT_ID, MAIB_MIA_CLIENT_SECRET);
const maibMiaToken = maibMiaAuth.accessToken;

Create a dynamic order payment QR

const maibMiaExpiresAt = new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString();
const maibMiaQrData = {
    'type': 'Dynamic',
    'expiresAt': maibMiaExpiresAt,
    'amountType': 'Fixed',
    'amount': 50.00,
    'currency': 'MDL',
    'orderId': '123',
    'description': 'Order #123',
    'callbackUrl': 'https://example.com/callback',
    'redirectUrl': 'https://example.com/success'
};

const maibMiaQrCreateResponse = await maibMiaApiRequest.qrCreate(maibMiaQrData, maibMiaToken);

Create a RTP (Request To Pay)

const maibMiaRtpData = {
    'alias': '3736xxxxxxx',
    'amount': 150.00,
    'expiresAt': maibMiaExpiresAt,
    'currency': 'MDL',
    'description': 'Invoice #123',
    'orderId': '123',
    'terminalId': 'P011111',
    'callbackUrl': 'https://example.com/callback',
    'redirectUrl': 'https://example.com/success'
};

const maibMiaRtpCreateResponse = await maibMiaApiRequest.rtpCreate(maibMiaRtpData, maibMiaToken);

Validate callback signature

const callbackData = {
    '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='
};

const validateCallbackResult = MaibMiaSdk.validateCallbackSignature(callbackData, MAIB_MIA_SIGNATURE_KEY);

Get QR details

const qrId = maibMiaQrCreateResponse.qrId;
const maibMiaQrDetailsResponse = await maibMiaApiRequest.qrDetails(qrId, maibMiaToken);

Perform a test QR payment

const maibTestPayData = {
    'qrId': qrId,
    'amount': maibMiaQrData.amount,
    'iban': 'MD88AG000000011621810140',
    'currency': maibMiaQrData.currency,
    'payerName': 'TEST QR PAYMENT'
};

const maibMiaTestPayResponse = await maibMiaApiRequest.testPay(maibTestPayData, maibMiaToken);

Get payment details

const payId = maibMiaTestPayResponse.payId;
const maibMiaPaymentDetailsResponse = await maibMiaApiRequest.paymentDetails(payId, maibMiaToken);

Refund payment

const maibMiaPaymentRefundData = {
    'reason': 'Test refund reason',
    // 'amount': 25.00, // Optional: for partial refund
    // 'callbackUrl': 'https://example.com/refund' // Optional
};

const maibMiaPaymentRefundResponse = await maibMiaApiRequest.paymentRefund(payId, maibMiaPaymentRefundData, maibMiaToken);