Skip to main content

This is a Python library for accessing the PAYDUNYA HTTP API.

Installation

$ sudo pip install paydunya
$ OR git clone https://github.com/paydunyadev/paydunya-python-master.git
$ cd paydunya-python-master; python setup.py install
$ nosetests tests/  # run unit tests

Read about nosetests

Usage

import paydunya
from paydunya import InvoiceItem, Store

# runtime configs
PAYDUNYA_ACCESS_TOKENS = {
    'PAYDUNYA-MASTER-KEY': "Your PAYDUNYA master key",
    'PAYDUNYA-PRIVATE-KEY': "Your PAYDUNYA private key",
    'PAYDUNYA-TOKEN': "Your PAYDUNYA token"
}
# defaults to False
paydunya.debug = True
# set the access/api keys
paydunya.api_keys = PAYDUNYA_ACCESS_TOKENS

# Invoice
store = Store(name='Magasin Chez Sandra')
items = [
    InvoiceItem(
        name="Clavier DELL",
        quantity=2,
        unit_price="3000",
        total_price="6000",
        description="Best Keyboard of the 2015 year"
    ),
    InvoiceItem(
        name="Ordinateur Lenovo L440",
        quantity=1,
        unit_price="400000",
        total_price="400000",
        description="Powerful and slim"
    ),
]
invoice = paydunya.Invoice(store)
invoice.add_items(items)
# taxes are (key,value) pairs
invoice.add_taxes([("Other TAX", 5000), ("TVA (18%)", 700)])
invoice.add_custom_data([
    ("first_name", "Alioune"),
    ("last_name", "Badara"),
    ("cart_id", 97628),
    ("coupon", "NOEL"),
])

# you can also pass the items, taxes, custom to the `create` method
successful, response = invoice.create()
if successful:
    do_something_with_resp(response)

# confirm invoice
invoice.confirm('YOUR_INVOICE_TOKEN')


# PSR
opr_data = {
    'account_alias': 'EMAIL_OU_NUMERO_DU_CLIENT_PAYDUNYA',
    'description': 'Hello World',
    'total_amount': 6500
}
store = paydunya.Store(name='Magasin Chez Sandra')
opr = paydunya.OPR(opr_data, store)
# You can also pass the data to the `create` function
successful, response = opr.create()
if successful:
   do_something_with_response(response)
status, _ = opr.charge({
    'token': token,
    'confirm_token': user_submitted_token
})

# Direct Pay
account_alias =  "EMAIL_OU_NUMERO_DU_CLIENT_PAYDUNYA"
amount =  6500
# toggle debug switch to True
direct_pay = paydunya.DirectPay(account_alias, amount)
status, response = direct_pay.process()

License

see LICENSE.txt

Contributing

Issues, forks, and pull requests are welcome!

Note

  • Some of the API calls require formal approval from PAYDUNYA

  • For more information, please read the PAYDUNYA HTTP API

  • Tested on Python 2.7, and 3+.

Authors

PAYDUNYA <paydunya@paydunya.com>

Release files for paydunya 1.0.7

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

Source distribution (sdist)

Source distribution for paydunya 1.0.7
File Size Uploaded
paydunya-1.0.7.tar.gz 144.5 kB Details

Built distribution (wheel)

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

Total release size: 152.3 kB

Release files / paydunya-1.0.7.tar.gz

Download URL paydunya-1.0.7.tar.gz
Size 144.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7082554efd622a84986ad470eda23d3c276408068436ad342ec0eb44c7e27d79
BLAKE2b-256 checksum
How to use checksums
46f837b80fc8c68b09f4c72c9f34cd7c545b15671aa34840b026d8ccffee704f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.2 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/22.2.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5

Release files / paydunya-1.0.7-py3-none-any.whl

Download URL paydunya-1.0.7-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb4d3185e028f8b2fb3ed17aef3661f4bba15477a3422f1ba30b02074f4fef5b
BLAKE2b-256 checksum
How to use checksums
a8feaae5100f14249c0288e56c6244cf2412b943548c273f737c6524b8e787a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.2 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/22.2.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

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