Skip to main content

Paga Collect Python library

The Paga Collect API allows anyone to initiate a payment request to a third party and automatically get notified when the payment request is fulfilled. This library makes it easier and faster for developers to integrate the API

1. Installation

Make sure you have pip installed, then run the command below

pip install pagacollect

2. Usage

Once installed to use the library see sample code below:

from pagacollect.paga_collect import Collect

principal = "public_key"
credentials = "private"
hash_key = "hash_key"

collect = Collect(principal, credentials, hash_key, False)

Paga Collect API Operations

Now that you have created a collect api object you easily call its operations


Request Payment

Register a new request for payment between a payer and a payee. Once a payment request is initiated successfully, the payer is notified by the platform (this can be suppressed) and can proceed to authorize/execute the payment. Once the payment is fulfilled, a notification is sent to the supplied callback URL. See the callback notification section for more details.
To make a payment request see sample code below:

payment_request_payload = {
    "referenceNumber": "6020000011z",
    "amount": "100",
    "currency": "NGN",
    "payer": {
        "name": "John Doe",
        "phoneNumber": "07033333333",
        "bankId": "3E94C4BC-6F9A-442F-8F1A-8214478D5D86"
    },
    "payee": {
        "name": "Payee Tom",
        "accountNumber": "1188767464",
        "bankId": "40090E2F-7446-4217-9345-7BBAB7043C4C",
        "bankAccountNumber": "0000000000",
        "financialIdentificationNumber": "03595843212"
    },
    "expiryDateTimeUTC": "2021-05-27T00:00:00",
    "isSuppressMessages": "true",
    "payerCollectionFeeShare": "0.5",
    "payeeCollectionFeeShare": "0.5",
    "isAllowPartialPayments": "true",
    "callBackUrl": "http://localhost:9091/test-callback",
    "paymentMethods": ["BANK_TRANSFER", "FUNDING_USSD"],
"displayBankDetailToPayer": False
}

response = collect.payment_request(payment_request_payload)

Register Persistent Payment Account

An operation for business to create Persistent Payment Account Numbers that can be assigned to their customers for payment collection.
To create a persistent payment account see sample code below:

register_persistent_payment_account_payload = {
    "referenceNumber": "test123451",
    "phoneNumber": "07022222222",
    "accountName": "Joh Doe",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "accountReference": "22222222222220",
    "financialIdentificationNumber": "22182799077",
    "creditBankId": "3E94C4BC-6F9A-442F-8F1A-8214478D5D86",
    "creditBankAccountNumber":"0000000000",
    "callbackUrl": "http://localhost:9091/test-callback"
}

response = collect.register_persistent_payment_account(register_persistent_payment_account_payload)

Query Status

Query the current status of a submitted request
To check the status of a submitted request see sample code below:

status_payload = {"referenceNumber": "82000001109", }

response = collect.get_status(status_payload)

Query History

Get payment requests for a period between given start and end dates. The period window should not exceed 1 month.
See sample code below:

history_payload = {
    "referenceNumber": "82000001109",
    "startDateTimeUTC" : "2021-05-13T19:15:22",
    "endDateTimeUTC" : "2021-05-20T19:15:22"
}

response = collect.get_history(history_payload)

Get Banks

Retrieve a list of supported banks and their complementary unique ids on the bank. This is required for populating the payer (optional) and payee objects in the payment request model.
See usage sample code below:

banks_payload = {"referenceNumber": "0001109"}

response = collect.get_banks(banks_payload)

Payment Request Refund

This end-point can be used to either cancel or initiate a refund if we were unable to fulfill the request for one reason or the other.
See usage sample code below:

refund_payload = 
{
  "referenceNumber" : "12345",
  "refundAmount" : 1000.0,
  "currency" : "NGN",
  "reason" : "no particular reason"
}
response = collect.payment_request_refund(refund_payload)

Delete Persistent Payment Account

This endpoint allows for deleting a persistent payment account.
See usage sample code below:

delete_payload = 
{
  "referenceNumber":"23402359879879997",
  "accountIdentifier":"0830202843",
  "reason":"off-boarded account"
 }
response = collect.delete_persistent_payment_account(delete_payload)

Get Persistent Payment Account

A method to query the properties associated with an existing persistent payment account.
See usage sample code below:

get_payload = 
{
  "referenceNumber":"23402359879879997",
  "accountIdentifier":"2806605308"
 }
response = collect.get_persistent_payment_account(get_payload)

Update Persistent Payment Account

This endpoint allows for changing any of the account properties except the accountNumber (NUBAN) and the accounReference properties which cannot be changed.
See usage sample code below:

update_payload = 
{
  "referenceNumber":"23402359879879996",
  "accountIdentifier":"0830202843",
  "phoneNumber":"0910220042",
  "firstName":"Renamed",
  "lastName": "Customer",
  "accountName": "Renamed Customer",
  "financialIdentificationNumber": "12345454666",
  "callbackUrl": "http://77d761893689.ngrok.io/persistent/000000000009/Password6",
  "creditBankId":"40090E2F-7446-4217-9345-7BBAB7043C4C",
  "creditBankAccountNumber":"0000000031"
 }
response = collect.update_persistent_payment_account(update_payload)

Metadata

Release files for pagacollect 1.0.5

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

Source distribution (sdist)

Source distribution for pagacollect 1.0.5
File Size Uploaded Provenance Actions
pagacollect-1.0.5.tar.gz 7.1 kB Without provenance Details for pagacollect-1.0.5.tar.gz

Built distribution (wheel)

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

Total release size: 14.2 kB

Release files / pagacollect-1.0.5.tar.gz

Download URL pagacollect-1.0.5.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7708683af407defb44168fb8ffb77a0acc6fd452d19da818be5d2d71f9937edf
BLAKE2b-256 checksum
How to use checksums
5e910572ca98a53e7b768556f1f2c85dd9fee64359627d60a4bdab9263f06d09
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.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

Release files / pagacollect-1.0.5-py3-none-any.whl

Download URL pagacollect-1.0.5-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b36725a62c810442dbacf45de9de2ed97c24d6d0e7e4268b7abd4245fdfd09c5
BLAKE2b-256 checksum
How to use checksums
9acf125ead79eae7caddaa4d2b5e5b2587ba2821b5b2c02e4f5049bd637a040f
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.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

Security for pagacollect 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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