Skip to main content

Installation

pip install pesepay

Getting Started

Import the library into your project/application

from pesepay import Pesepay

Create an instance of the Pesepay class using your integration key and encryption key as supplied by Pesepay.

pesepay = Pesepay("INTEGRATION KEY", "ENCRYPTION KEY");

Set return and result urls

pesepay.result_url = 'https://example.com/result'
pesepay.return_url = 'https://example.com/return'

Make seamless payment

Create the payment

NB: Customer email or number should be provided
payment = pesepay.create_payment('CURRECNCY_CODE', 'PAYMENT_METHOD_CODE', 'CUSTOMER_EMAIL', 
   'CUSTOMER_PHONE_NUMBER(OPTIONAL)', 'CUSTOMER_NAME(OPTIONAL)')

Create a dict of the required fields (if any)

required_fields = {'requiredFieldName': 'requiredFieldValue'}

Send of the payment

response = pesepay.make_seamless_payment(payment, 'PAYMENT_REASON', 1.00, required_fields)

if response.success:
    # Save the reference number and/or poll url (used to check the status of a transaction)
    poll_url = response.pollUrl
    reference_number = response.referenceNumber

else:
    # Get Error Message
    message = response.message

Make redirect payment

Create a transaction

transaction = pesepay.create_transaction(amount, 'CURRENCY_CODE', 'PAYMENT_REASON')

Initiate the transaction

response = pesepay.initiate_transaction(transaction)

if response.success:
    # Save the reference number and/or poll url (used to check the status of a transaction)
    poll_url = response.pollUrl
    reference_number = response.referenceNumber
    # Get the redirect url and redirect user to complete transaction   
    redirect_url = response.redirectUrl

else:
    # Get Error Message
    message = response.message

Check Payment Status

Method 1: Check using reference number

response = pesepay.check_payment(reference_number)
if response.success:
    if response.paid:
        # Payment was successful
else:
    # Get Error Message
    message = response.message

Method 2: Check using poll url

response = pesepay.poll_transaction(poll_url)
if response.success:
    if response.paid:
        # Payment was successful
else:
    # Get Error Message
    message = response.message

Metadata

Release files for pesepay 1.0.8

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

Source distribution (sdist)

Source distribution for pesepay 1.0.8
File Size Uploaded
pesepay-1.0.8.tar.gz 4.3 kB Details

Built distribution (wheel)

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

Total release size: 9.8 kB

Release files / pesepay-1.0.8.tar.gz

Download URL pesepay-1.0.8.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d367d966aded7355410752a2bdff2923d121276c0b96854f2ba735dfe9772ba4
BLAKE2b-256 checksum
How to use checksums
c931a039b3ca7d9282e058ad4bcc028094969acbb1d2d88c95435a15b037c56a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release files / pesepay-1.0.8-py3-none-any.whl

Download URL pesepay-1.0.8-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73e87797c25b6df2eeefe4c1c5d3db978f29a933b7790b675e35782827de5e98
BLAKE2b-256 checksum
How to use checksums
d92ce0777a23f666e79e370e1c163de9f65802519591b8c1ce012619f30a2b75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

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