Skip to main content

Python Implementation for Mobile payments integrations.

Project description

PyPesa

Python Pesa SDK

Installation

This package is available in Python Package Index and can be installed using pip

pip install pypesa

The package comprise both original open API codes and refactored codes.

To use original open API code import open_api module

from pypesa.open_api import APIContext, APIMethodType, APIRequest

To use refactored code import MPESA from vodacom module.

from pypesa.vodacom import MPESA

Features

  • Customer-to-business
  • Business-to-customer
  • Business-to-business
  • Reversal
  • Transaction status

Pre-requisites

The following are required and are obtained from Vodacom Open Api portal

  • Api Key
  • Public Key

Examples

Customer to Business payment via vodacom m-pesa

# vodacom M-PESA
from mobile_payments.vodacom import MPESA

api_key = '<your-api-key>'
public_key = '<open-api-public-key>'

m_pesa = MPESA(api_key=api_key, public_key=public_key)

# Customer to Business payment
parameters = {
    'input_Amount': '1000', # amount to be charged
    'input_Country': 'TZN',
    'input_Currency': 'TZS',
    'input_CustomerMSISDN': '000000000001',
    'input_ServiceProviderCode': '000000',
    'input_ThirdPartyConversationID': 'c9e794e10c63479992a8b08703abeea36',
    'input_TransactionReference': 'T23434ZE3',
    'input_PurchasedItemsDesc': 'Shoes',
}

response = m_pesa.customer2business(parameters)

License

Code released under MIT LICENSE

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

pypesa-0.0.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypesa-0.0.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file pypesa-0.0.1.tar.gz.

File metadata

  • Download URL: pypesa-0.0.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.7.9 Windows/10

File hashes

Hashes for pypesa-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a19e04047a70bd3488167b02d2c29058dbcbb0532f200c19f4511afa1d58ba27
MD5 3c62afd8fc5a643f85ed715475068cd4
BLAKE2b-256 2043ceaa8c388c2de32915afd71495ce8da488e414aff0036904c12e837aa732

See more details on using hashes here.

File details

Details for the file pypesa-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pypesa-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.7.9 Windows/10

File hashes

Hashes for pypesa-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d78ff26465e67a3c0ba0411e50153ae446bfbd16bd443377ed82e395b412c604
MD5 49723a74b4a3e7f59a8b345ce5eb5820
BLAKE2b-256 92964db38e279994aec82b15b914d56bc6239ccc36ef2f55f562cd7d95235547

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page