Python SDK for maib MIA API
- maib MIA QR API docs: https://docs.maibmerchants.md/mia-qr-api
- maib Request to Pay (RTP) docs: https://docs.maibmerchants.md/request-to-pay
- GitHub project https://github.com/alexminza/maib-mia-sdk-python
- PyPI package https://pypi.org/project/maib-mia-sdk/
Installation
To easily install or upgrade to the latest release, use pip:
pip install --upgrade maib-mia-sdk
Getting started
Import SDK:
from maib_mia_sdk import MaibMiaSdk, MaibMiaAuthRequest, MaibMiaApiRequest
Add project configuration:
import os, datetime
MAIB_MIA_CLIENT_ID = os.getenv('MAIB_MIA_CLIENT_ID')
MAIB_MIA_CLIENT_SECRET = os.getenv('MAIB_MIA_CLIENT_SECRET')
MAIB_MIA_SIGNATURE_KEY = os.getenv('MAIB_MIA_SIGNATURE_KEY')
SDK usage examples
Get Access Token with Client ID and Client Secret
maib_mia_auth = MaibMiaAuthRequest \
.create(base_url=MaibMiaSdk.SANDBOX_BASE_URL) \
.generate_token(client_id=MAIB_MIA_CLIENT_ID, client_secret=MAIB_MIA_CLIENT_SECRET)
maib_mia_token = maib_mia_auth['accessToken']
Create a dynamic order payment QR
maib_mia_qr_data = {
'type': 'Dynamic',
'expiresAt': (datetime.datetime.now() + datetime.timedelta(hours=24)).isoformat(),
'amountType': 'Fixed',
'amount': 50.00,
'currency': 'MDL',
'orderId': '123',
'description': 'Order #123',
'callbackUrl': 'https://example.com/callback',
'redirectUrl': 'https://example.com/success'
}
maib_mia_api_request = MaibMiaApiRequest.create(base_url=MaibMiaSdk.SANDBOX_BASE_URL)
maib_mia_create_qr_response = maib_mia_api_request.qr_create(
data=maib_mia_qr_data,
token=maib_mia_token)
Create a RTP (Request To Pay)
maib_mia_rtp_data = {
'alias': '3736xxxxxxx',
'amount': 50.00,
'currency': 'MDL',
'expiresAt': (datetime.datetime.now() + datetime.timedelta(hours=24)).isoformat(),
'description': f'Order #123',
'orderId': '123',
'callbackUrl': 'https://example.com/callback',
'redirectUrl': 'https://example.com/success'
}
maib_mia_create_rtp_response = maib_mia_api_request.rtp_create(
data=maib_mia_rtp_data,
token=maib_mia_token)
Validate callback signature
callback_data = {
"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="
}
validate_callback_result = MaibMiaSdk.validate_callback_signature(
callback_data=callback_data,
signature_key=MAIB_MIA_SIGNATURE_KEY)
Perform a test QR payment
maib_test_pay_data = {
'qrId': maib_mia_create_qr_response['qrId'],
'amount': maib_mia_qr_data['amount'],
'iban': 'MD88AG000000011621810140',
'currency': maib_mia_qr_data['currency'],
'payerName': 'TEST QR PAYMENT'
}
maib_mia_test_pay_response = maib_mia_api_request.test_pay(
data=maib_test_pay_data,
token=maib_mia_token)
Get payment details
maib_mia_payment_details_response = maib_mia_api_request.payment_details(
pay_id=maib_mia_test_pay_response['payId'],
token=maib_mia_token)
Refund payment
maib_mia_pay_refund_data = {
'reason': 'Test refund reason'
}
maib_mia_refund_details_response = maib_mia_api_request.payment_refund(
pay_id=maib_mia_test_pay_response['payId'],
data=maib_mia_pay_refund_data,
token=maib_mia_token)
Metadata
Release files for maib-mia-sdk 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maib_mia_sdk-1.1.4.tar.gz | 21.3 kB | With provenance | Details for maib_mia_sdk-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maib_mia_sdk-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for maib_mia_sdk-1.1.4-py3-none-any.whl |
Total release size: 42.8 kB
Release files / maib_mia_sdk-1.1.4.tar.gz
| Download URL | maib_mia_sdk-1.1.4.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34d3cd97b0d422d8a9d1dc082c31c429442b36798cdf6c681e455e41d736d8e5
|
|
BLAKE2b-256 checksum How to use checksums |
db7bec18f62bf2125068512155cf30782273c55061da09a7776d71e45e7e96b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2025.
Transparency logRelease files / maib_mia_sdk-1.1.4-py3-none-any.whl
| Download URL | maib_mia_sdk-1.1.4-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d002fe555c96d56506999a974706e4b093022697c0dc971d9dbb054ef2f9300
|
|
BLAKE2b-256 checksum How to use checksums |
5ec0fe75dcdc3fc804eeeaddd421f7e1ec3c804300b81ab0bb8a3cc40b9d1e20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2025.
Transparency logSecurity for maib-mia-sdk 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for maib_mia_sdk-1.1.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.