Python SDK for Victoriabank MIA API
Project description
Python SDK for Victoriabank MIA API
- Victoriabank IPS Business WebApi docs: https://test-ipspj.victoriabank.md
- Victoriabank IPS DemoPay WebApi https://test-ipspj-demopay.victoriabank.md/swagger/
- GitHub project https://github.com/alexminza/victoriabank-mia-sdk-python
- PyPI package https://pypi.org/project/victoriabank-mia-sdk/
Installation
To easily install or upgrade to the latest release, use pip:
pip install --upgrade victoriabank-mia-sdk
Getting started
Import SDK:
from victoriabank_mia_sdk import VictoriabankMiaSdk, VictoriabankMiaAuthRequest, VictoriabankMiaApiRequest
Add project configuration:
import os, datetime
VB_PUBLIC_KEY_PATH = os.getenv('VB_PUBLIC_KEY_PATH')
VB_MIA_USERNAME = os.getenv('VB_MIA_USERNAME')
VB_MIA_PASSWORD = os.getenv('VB_MIA_PASSWORD')
VB_IBAN = os.getenv('VB_IBAN')
SDK usage examples
Get Access Token with username and password
vb_mia_auth = VictoriabankMiaAuthRequest \
.create(base_url=VictoriabankMiaSdk.SANDBOX_BASE_URL) \
.generate_token(username=VB_MIA_USERNAME, password=VB_MIA_PASSWORD)
vb_mia_token = vb_mia_auth['accessToken']
Create a dynamic order payment QR
vb_mia_qr_data = {
'header': {
'qrType': 'DYNM', # Type of QR code: DYNM - Dynamic QR, STAT - Static QR, HYBR - Hybrid QR
'amountType': 'Fixed', # Specifies the type of amount: Fixed - Dynamic QR, Controlled - Static QR, Free - Hybrid QR
'pmtContext': 'e' #Payment context: m - mobile payment, e - e-commerce payment, i - invoice payment, 0 - other
},
'extension': {
'creditorAccount': {
'iban': f'{VB_IBAN}' # The account from which funds will be debited credited.
},
'amount': {
'sum': 123.45, # The total sum to be paid.
'currency': 'MDL' # The currency in which the sum is specified.
},
'dba': 'TEST SRL', #Commercial name that will appear in client APP.
'remittanceInfo4Payer': 'Order #123', #Payment destination.
'creditorRef': '123', #External payment reference.
'ttl': {
'length': 60, #The duration for which the QR code is valid.
'units': 'mm' #The unit of time for the TTL: ss - seconds, mm - minutes
}
}
}
vb_mia_api_request = VictoriabankMiaApiRequest.create(base_url=VictoriabankMiaSdk.SANDBOX_BASE_URL)
vb_mia_create_qr_response = vb_mia_api_request.qr_create(
data=vb_mia_qr_data,
token=vb_mia_token)
Decode callback and validate signature
callback_jwt = """eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduYWxDb2RlIjoiRXhwaXJhdGlvbiIsInNpZ25hbER0VG0iOiIyMDI0LTEwLTAxVDE1OjA3OjQ1KzAzOjAwIiwicXJIZWFkZXJVVUlEIjoiYmQxMjA0OWItNjUxZC00MGEwLWIyYmMtZDZhMGY3ZTJiN2M3IiwicXJFeHRlbnNpb25VVUlEIjoiNjU0YWNkNjktNjAyYy00MzUxLTk1OTItODE0M2FlMjhkM2U0IiwicGF5bWVudCI6bnVsbH0.WJ5t8jtg2_6DPrxQNIcu50gsW7cDC8IMdjvOBO9wW3toIdeAljlMPxd_lLCWJiKXToRAVHU7a1EB4mLyzyw1iCcRadnsSqm21TrpDZWTjv3uL-XiMLrWOsGBf0aJJRFcGbysU_ym9YLonQMmYLF0voq39yAPMHO7CLCniSMhVdJ9Q5xnrq52y6Yn5YzefCNb2tAQ-erm-8_mCaF0DWd0UFhPA6TRXyV2l5GCkLbyhlUB9gVoVTdSN-XxA_1aoNTusheZPDH1InL03Bx3G8muaVxOMrMIsVCJJYAaTFKiQTBf0M49oTQpdPWeeS9wHaS7aSS3gUcFsOOEPavj7J8vxg"""
with open(VB_PUBLIC_KEY_PATH, mode='rb') as vb_public_key_file:
vb_public_key_pem = vb_public_key_file.read()
decoded_payload = VictoriabankMiaSdk.decode_callback(
callback_jwt=callback_jwt,
public_key_pem=vb_public_key_pem)
Perform a test QR payment
vb_test_pay_data = {
'qrHeaderUUID': vb_mia_create_qr_response['qrHeaderUUID']
}
vb_test_pay_response = vb_mia_api_request.test_pay(
data=vb_test_pay_data,
token=vb_mia_token)
Get payment details
vb_qr_extension_status_response = vb_mia_api_request.qr_extension_status(
qr_extension_id=vb_mia_create_qr_response['qrExtensionUUID'],
token=vb_mia_token)
Refund payment
vb_payment_reference: str = vb_qr_extension_status_response['payments'][0]['reference']
vb_transaction_id = vb_payment_reference.split('|')[3]
vb_transaction_reverse_response = vb_mia_api_request.transaction_reverse(
transaction_id=vb_transaction_id,
token=vb_mia_token)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 victoriabank_mia_sdk-1.1.3.tar.gz.
File metadata
- Download URL: victoriabank_mia_sdk-1.1.3.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
762d007dfb36cb8faae10e8771da088b9717c2df4f981719eda800218acd4b39
|
|
| MD5 |
9c0a420291c528849b777d71a727364f
|
|
| BLAKE2b-256 |
cbda0ba9c5d8848c4d6c4edfd48b5418ddb3cc7220a6533c906fb982958f140b
|
Provenance
The following attestation bundles were made for victoriabank_mia_sdk-1.1.3.tar.gz:
Publisher:
action-pypi-publish.yml on alexminza/victoriabank-mia-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
victoriabank_mia_sdk-1.1.3.tar.gz -
Subject digest:
762d007dfb36cb8faae10e8771da088b9717c2df4f981719eda800218acd4b39 - Sigstore transparency entry: 538028057
- Sigstore integration time:
-
Permalink:
alexminza/victoriabank-mia-sdk-python@4dfb6078e1729de84fd0dbffcc337051e0134b3a -
Branch / Tag:
refs/tags/v1.1.3 - Owner: https://github.com/alexminza
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
action-pypi-publish.yml@4dfb6078e1729de84fd0dbffcc337051e0134b3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file victoriabank_mia_sdk-1.1.3-py3-none-any.whl.
File metadata
- Download URL: victoriabank_mia_sdk-1.1.3-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe6566003c1e7177ae583ced66f7d767198940c8e26654e924022788ccdc1302
|
|
| MD5 |
6ea4f0913bb0121e8e44045b92457230
|
|
| BLAKE2b-256 |
175764a0ee9bf32061ef8845c1325d335e46d6fa43a9cbc6a802a49a8e128104
|
Provenance
The following attestation bundles were made for victoriabank_mia_sdk-1.1.3-py3-none-any.whl:
Publisher:
action-pypi-publish.yml on alexminza/victoriabank-mia-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
victoriabank_mia_sdk-1.1.3-py3-none-any.whl -
Subject digest:
fe6566003c1e7177ae583ced66f7d767198940c8e26654e924022788ccdc1302 - Sigstore transparency entry: 538028071
- Sigstore integration time:
-
Permalink:
alexminza/victoriabank-mia-sdk-python@4dfb6078e1729de84fd0dbffcc337051e0134b3a -
Branch / Tag:
refs/tags/v1.1.3 - Owner: https://github.com/alexminza
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
action-pypi-publish.yml@4dfb6078e1729de84fd0dbffcc337051e0134b3a -
Trigger Event:
push
-
Statement type: