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 (C2B)
  • Business to Customer (B2C)
  • Business to Business (B2B)
  • Payment Reversal
  • Transaction Status
  • Direct debit creation and Payment

Pre-requisites

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

  • Api Key
  • Public Key

See more in documentation.

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)

Check more examples of methods and responses in docs

Credits

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.2.tar.gz (7.6 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.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pypesa-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7fe7bfa967bfbd3853002c3907f576849c9e2a5c3f5b6a0489fda7d39ca27db5
MD5 9af63974f019544abee40fdc114acdcb
BLAKE2b-256 f198c83472a1f1628791c414b1c0183bd584bbffeb7dc0b7ccd61e0e83fa48c1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pypesa-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 46ae41600b8157adf2ff8e1c45a811bde7294e8488279fc7c8eb94d6708c3b8e
MD5 888bc2382c146ad6684f8e11d7210b8c
BLAKE2b-256 fb46ceb1169bfaa530a8307a200a5e210f80cbdff990ddedaf22b58e725aaf85

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