Python SDK for maib MIA QR API
Project description
Python SDK for maib MIA QR API
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 description',
'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)
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
maib_mia_sdk-1.0.2.tar.gz
(18.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maib_mia_sdk-1.0.2.tar.gz.
File metadata
- Download URL: maib_mia_sdk-1.0.2.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a74098e329116d85483967f91f7ba5c805f018456cb58aec5be5c8263832d5df
|
|
| MD5 |
0c162993ff9fc644cc3a98b5debcafe7
|
|
| BLAKE2b-256 |
195a576a8aad5af5fa64b3ec5cdbae6653fb94322dec99d7c587d68efc8ff6d0
|
File details
Details for the file maib_mia_sdk-1.0.2-py3-none-any.whl.
File metadata
- Download URL: maib_mia_sdk-1.0.2-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19aed152db26502e97fd1e5c050661eafc6c84d0088568ae9f0d16ba0bfa725a
|
|
| MD5 |
27b8264af7b41384924bd6c51a1c7ce7
|
|
| BLAKE2b-256 |
a40101f6b3a8674ca3b23dc8d78e1552dd17451be9e1d6e17ef8074d53a838e4
|