Skip to main content

A python wrapper for MedaPay you'll love

Project description

MedaPay Python SDK

MedaPay Python Library#

The MedaPay Python SDK provides convenient access to the MedaPay API from applications written in server-side python.

For complete request/response flow and types please check HTTP API Guide.

**Installation

Install the package with:

pip install medapaysdk

**Usage

The package needs to be configured with your account's bearer token, which is provided by MedaPay team. Require it and initialize with the provided token and preferred environment value:

Import MedaPay from "medapaysdk"

medaPay = MedaPay( isSandBox = True, merchantBearerToken = "Bearer blah-blah-blah", callbackWebhook = "https://test.herokuapps.com/" | None,  callbackVerifyToken = "Verification token" | None )
You can either set callbackWebhook or not, it'll help you in payment push notification when working with none Amole payment methods

Amole Instance

Initialize new Amole Instance

orderId, billref, paymentInstance = medaPay.amole( name = "Abebe bekila", clientPhone = "251911355516", amount = 4, description = "A 4 birr bill to me", otp_sent_callback = def Callback )

Initialize from a pre-existing Bill reference

orderId, billref, paymentInstance = medaPay.amoleBill( name = "Abebe bekila", clientPhone = "251911355516", amount = 4, description = "A 4 birr bill to me", otp_sent_callback = def Callback )

After calling either of the above otp is directly sent. Will throw error if otp couldn’t be sent or if the bill is already paid or canceled

Amole Payment

isPaid: bool = paymentInstance.verifyPayment( otp = "4633" )["status"] == "PAYED"

Raw Bill creation

orderId, billref = medaPay.createBill(clientPhone = "251911355516" , amount = 4, name = "Abebe bekila" , method = "CBEBirr" | "mBirr" | "HelloCash", description="Something new")

Bill status retrieval

referenceNumber, accountNumber, status, amount, issuerName, createdAt, description = medaPay.getBillDetails(billref = 10000054)

isPayed: bool = (status == "PAYED")

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

medapaysdk-0.0.1.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

medapaysdk-0.0.1-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

Supported by

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