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.3.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.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pypesa-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4a5f038945cbef9ab1e60176ed323d2c820ef354971ceab88f00d1de83f72b27
MD5 b9616e0a8fed87dc0ae6e25c35013a5c
BLAKE2b-256 4dcf40e03b5c28e1ebfe38533f4b1b6bab880131928cd1de3bfcf69b8f9b3feb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pypesa-0.0.3-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.8.2 Windows/10

File hashes

Hashes for pypesa-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 42274d4882ca0ea4677fbf73042c34eaf813127c4c31b47d9bc06295956f52b0
MD5 49ce6c5e8fa0ae1e6d65733d86d5d038
BLAKE2b-256 709d84addd2f1ae29bdabfa951405e5b3c3f4f4c55630a4ee6433532e2e4caf5

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