Skip to main content

myropay-python

Official Python library for the MyroPay API. No third-party dependencies — uses the standard library's urllib.

Install

pip install myropay

Usage

import myropay
myropay.api_key = 'sk_test_...'

charge = myropay.Charge.create(
    email='customer@email.com',
    amount=500000,       # whole currency units — ₦500,000, not kobo
    currency='NGN',       # optional, defaults to NGN
    reference='ORD-1029', # optional, your own order id
)

print(charge.checkout_url)  # redirect your customer here

Retrieve a charge later:

charge = myropay.Charge.retrieve('cs_test_...')
if charge.status == 'completed':
    ...  # fulfil the order

Important

  • api_key (sk_live_... / sk_test_...) must never reach a browser — use this library from your own server/backend only. Get your keys from the MyroPay business dashboard under API & Apps.
  • Amounts are in the currency's own whole units (e.g. 500000 NGN = ₦500,000), not subunits like kobo or cents.
  • For a client-side "Pay with MyroPay" button/modal that never needs your secret key, use the Checkout SDK (myropay.js) instead — this package is for server-side charge creation and verification.

Errors

from myropay.error import MyroPayError

try:
    myropay.Charge.create(amount=5000)  # missing email
except MyroPayError as e:
    print(e.message, e.http_status)

InvalidRequestError is raised for missing/invalid parameters before a request is sent; APIError (and AuthenticationError for a bad key) for errors returned by the API itself.

License

MIT

Release files for myropay 1.0.0

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

Source distribution (sdist)

Source distribution for myropay 1.0.0
File Size Uploaded
myropay-1.0.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for myropay 1.0.0
File Interpreter ABI Platform
myropay-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / myropay-1.0.0.tar.gz

Download URL myropay-1.0.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
59be1203d7c38aed21ac41147ca4c90ed2a9a04a3401fb47d598203644d05510
BLAKE2b-256 checksum
How to use checksums
0a15f62da5c53fe4f586bbf617bbab042bbaee8e5ad392538eaf9b42e7b4ec2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / myropay-1.0.0-py3-none-any.whl

Download URL myropay-1.0.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3d85352324428bcabb17924e8862888838891c72925d66525614981becded32
BLAKE2b-256 checksum
How to use checksums
6235ea27fe2d82c25753c7283917e576bedd0d3b1c193804105496c4090d0526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

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