Skip to main content

Python SDK for PayChangu Level

Project description

PayChangu SDK for Python

A powerful and easy-to-use Python SDK for integrating PayChangu payment services into your applications. This SDK provides seamless access to PayChangu's suite of payment solutions including Mobile Money payments, payouts, airtime purchases, and direct charges.

Features

  • Mobile Money Payments
  • Mobile Money Payouts
  • Airtime Purchase
  • Direct Mobile Money Charges
  • Simple API Integration
  • Comprehensive Error Handling
  • Type Hints Support
  • Python 3.7+ Compatible

Installation

You can install the PayChangu SDK using pip:

pip install paychangu

Usage

To use the PayChangu SDK, you need to create an instance of the PayChanguClient class with your secret key:

from paychangu import PayChanguClient

client = PayChanguClient(secret_key="your_secret_key")

Level

Initiate a Transaction

from paychangu.models.payment import Payment
payment = Payment(
    amount=100,
    currency="MWK",
    email="user@example.com",
    first_name="John",
    last_name="Doe",
    callback_url="https://example.com/callback",
    return_url="https://example.com/return",
    tx_ref="unique_transaction_reference",
    customization={
        "title": "Test Payment",
        "description": "Payment Description",
    },
    meta={
        "uuid": "uuid",
        "response": "Response",
    },
)
response = client.initiate_transaction(payment)
print(response)

Verify a Transaction

tx_ref = "unique_transaction_reference"
response = client.verify_transaction(tx_ref)
print(response)

Payout

Get Payout Operators

operators = client.payout_service.get_operators()
print(operators)

Initiate a Payout

from paychangu.models.payout import Payout
payout = Payout(
amount=100,
currency="MWK",
mobile_number="1234567890",
network="TNM",
reference="unique_payout_reference",
callback_url="https://example.com/callback",
)
response = client.payout_service.initiate_payout(payout)
print(response)

Fetch Transfer Details

charge_id = "jvivuiviu"
response = client.payout_service.fetch_transfer(charge_id)
print(response)

Airtime

Get Airtime Operators

operators = client.airtime_service.get_operators()
print(operators)

Create an Airtime Bill

amount = 100
phone_number = "1234567890"
operator_id = "airtel"
response = client.airtime_service.create_bill(amount, phone_number, operator_id)
print(response)

Direct Charge MoMo

Get Supported Operators

operators = client.direct_charge_service.get_supported_operators()
print(operators)

Initialize a Direct Charge

mobile = "1234567890"
mobile_money_operator_ref_id = "airtel"
amount = 100
charge_id = "airtel"
email = "user@example.com"
first_name = "John"
last_name = "Doe"
response = client.direct_charge_service.initialize_payment(amount, currency, mobile, mobile_money_operator_ref_id, charge_id, email, first_name, last_name)
print(response)

Verify a Direct Charge

charge_id = "charge_id_from_initialize_payment_response"
response = client.direct_charge_service.verify_charge(charge_id)
print(response)

Get Charge Details

charge_id = "charge_id_from_initialize_payment_response"
response = client.direct_charge_service.get_charge_details(charge_id)
print(response)

Support

For support, email support@paychangu.com or visit our support page.

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

paychangu-0.0.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paychangu-0.0.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file paychangu-0.0.3.tar.gz.

File metadata

  • Download URL: paychangu-0.0.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for paychangu-0.0.3.tar.gz
Algorithm Hash digest
SHA256 be32654eff6b54aa41ae151f083ccf0c5a9b39b01d7d607d504be5ce97b92fae
MD5 c68b780e78e8c3780d646f1ad92d33dd
BLAKE2b-256 57a05beae13f9df631bb643295f073007e0017e5560ef5f1119772d94093f7f6

See more details on using hashes here.

File details

Details for the file paychangu-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: paychangu-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for paychangu-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3f37624106e84a5de75e4638dca9641e06df87577ed5a0ebfff4d55e4190af4e
MD5 a7a6398444769d15daf7040c00c62abf
BLAKE2b-256 9b60f1bb2de53877369948eed6a1229376c9fdfdc0e68c95061e5bbdd2857769

See more details on using hashes here.

Supported by

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