Skip to main content

Python package for MVOLA API

###Installation

    python -m pip install mvola_api

###Exemple

import os
import uuid
from datetime import datetime as dt
from pathlib import Path
from mvola_api import MVolaMerchantPayAPI, AUthResult, Config, MvolaTransactionData, HashedMap,PRODUCTION_URL
from dotenv import dotenv_values
#load .env
config = dotenv_values(Path(os.getcwd(), '.env'))

# for sandbox
api: MVolaMerchantPayAPI = MVolaMerchantPayAPI()

# for production 
api: MVolaMerchantPayAPI = MVolaMerchantPayAPI(PRODUCTION_URL)

# revoke token

api.revoke_token(config.get('CONSUMER_KEY'), config.get('CONSUMER_SECRET'), True)

# The third parameter fro revoke_token is to auto update Bearer token for the API, So, no need to call set_access_token 
# If you want to load access token

auth_data = api.revoke_token(config.get('CONSUMER_KEY'), config.get('CONSUMER_SECRET'), True)

print(auth_data.access_token)

#Transaction
#create transaction config

transaction_config: Config = Config(**{
    'version': "1.0",
    'xCorrelationID': f'{uuid.uuid4()}',
    'userLanguage': "MG",
    'userAccountIdentifier': "msisdn;034350003",
    'partnerName': "Mvola API"
})
#  init transaction  config
api.init_config(transaction_config)

transaction: MvolaTransactionData = MvolaTransactionData(**{
    'amount': 500,
    'currency': "Ar",
    'descriptionText': "Description",
    'requestDate': dt.now().isoformat(),
    'debitParty': [
        HashedMap(**{
            'key': "msisdn",
            'value': "034350003",
        })
    ],
    'creditParty': [
        HashedMap(**{
            'key': "msisdn",
            'value': "034350003",
        }),
    ],
    'metadata': [
        HashedMap(**{
            'key': "partnerName",
            'value': "Mvola API",
        }),
        HashedMap(**{
            'key': "fc",
            'value': "USD",
        }),
        HashedMap(**{
            'key': "amountFc",
            'value': "1",
        }),
    ],
    'requestingOrganisationTransactionReference': f'{uuid.uuid4()}',
    'originalTransactionReference': f'{uuid.uuid4()}',
})
# start transaction
transaction_response = api.initiate_transaction(transaction)
print(transaction_response)

# get details

transaction_details = api.get_details(transactionId)

#get status
transaction_status = api.get_status(serverCorrelationId)

Metadata

Release files for mvola-api 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mvola-api 1.0.2
File Size Uploaded
mvola-api-1.0.2.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mvola-api 1.0.2
File Interpreter ABI Platform
mvola_api-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / mvola-api-1.0.2.tar.gz

Download URL mvola-api-1.0.2.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5a9e8ab286fe4590c96fe1ea5ad2734e78123703ca959c955ceb544a5a540bbf
BLAKE2b-256 checksum
How to use checksums
7bebae84305f33303e2b6da8fc6d3bc1f737693485bec72dae272c0ea02c24ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.2 Windows/10

Release files / mvola_api-1.0.2-py3-none-any.whl

Download URL mvola_api-1.0.2-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bc6f9fd9f70c787b22c9c73adf006c91e1f079805c846dc18812ee768ab484d
BLAKE2b-256 checksum
How to use checksums
c0fe52df3940a7370b9529e34035fdcc0f4eb7e3f112d8e4ca643988a2229638
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.2 Windows/10

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page