Skip to main content

Python SDK for the Ilambit DevPort API — BharatPe payment verification & history

Project description

devport

Python SDK for the Ilambit DevPort API — BharatPe payment verification & history.

Private package — All rights reserved.

Installation

pip install devport

Or install from the built wheel:

pip install dist/devport-0.1.0-py3-none-any.whl

Quick Start

Verify a payment

from devport import bharatpe

result = bharatpe.payment_status(
    api_key="ilm_live_your_api_key_here",
    transaction_id="432112345678",
)

if result.verified:
    print(f"✅ Payment verified! Amount: ₹{result.transaction.amount}")
    print(f"   Payer: {result.transaction.payer_name}")
    print(f"   Status: {result.transaction.status}")
elif result.found:
    print(f"⏳ Transaction found but status is: {result.transaction.status}")
else:
    print("❌ Transaction not found.")

Payment history

from devport import bharatpe

history = bharatpe.payment_history(
    api_key="ilm_live_your_api_key_here",
    days=3,  # 1–7 days
)

print(f"Found {history.total} transactions in the last {history.lookback_days} days:")
for txn in history.transactions:
    print(f"  {txn.bank_reference_no}: ₹{txn.amount}{txn.status}")

Using the client class (avoid repeating your API key)

from devport import DevPort

client = DevPort(api_key="ilm_live_your_api_key_here")

# Same functions, no need to pass api_key each time
result = client.bharatpe.payment_status(transaction_id="432112345678")
history = client.bharatpe.payment_history(days=3)

Error Handling

Every API error is mapped to a specific exception:

from devport import bharatpe
from devport import (
    DevPortError,         # Base — catches all API errors
    AuthenticationError,  # Invalid/revoked API key
    RateLimitError,       # Too many requests (has .retry_after)
    CreditError,          # No credits remaining
    NetworkError,         # Can't reach the server
)

try:
    result = bharatpe.payment_status(
        api_key="ilm_live_...",
        transaction_id="432112345678",
    )
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
except AuthenticationError as e:
    print(f"Auth failed: {e.code}{e.message}")
except CreditError:
    print("No credits remaining. Purchase a package.")
except DevPortError as e:
    print(f"API error: {e}")
except NetworkError:
    print("Cannot reach DevPort API. Check your connection.")

Configuration

Parameter Default Description
api_key (required) Your DevPort API key
base_url https://devport.ilambit.in API base URL (override for dev)
timeout 30.0 Request timeout in seconds

Local development

Point the SDK at your local gateway:

from devport import DevPort

client = DevPort(
    api_key="ilm_live_...",
    base_url="http://localhost:3000",
)

Response Types

All functions return typed dataclasses:

  • PaymentStatusResult.verified, .found, .message, .transaction, .meta
  • PaymentHistoryResult.transactions, .total, .lookback_days, .meta
  • BharatPeTransaction.transaction_id, .bank_reference_no, .amount, .status, .mode, .payer_vpa, .payer_name, .transaction_date, .extra
  • ResponseMeta.requests_remaining, .latency_ms, .timestamp

Building from source

# Install build dependencies
pip install build

# Build wheel + sdist
python -m build

# Output is in dist/
#   devport-0.1.0-py3-none-any.whl
#   devport-0.1.0.tar.gz

Publishing (private)

# Upload to a private PyPI registry
pip install twine
twine upload --repository-url https://your-private-pypi/ dist/*

Requirements

  • Python 3.9+
  • httpx (installed automatically)

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

devport-0.1.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

devport-0.1.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file devport-0.1.1.tar.gz.

File metadata

  • Download URL: devport-0.1.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for devport-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bb3664f7e0ee26255029ad82ce8529718a935ec772f347cbad2a477f315d87b4
MD5 2ecb04693593f54250910bbbcb7dba78
BLAKE2b-256 f5152da66b367f8e90b0e124daa86fcc3ffe05c0cbb26412f560c09c006b1af9

See more details on using hashes here.

File details

Details for the file devport-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: devport-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for devport-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06ce4e2a4d18cf65802223b6d01b3a03082eb391141c74751c0d138854c92459
MD5 c11b2e8f1077ca1857da5dc65bc1f22d
BLAKE2b-256 4841bb9195df753cd2ac8e00a6e0b64341baa4b4f06353b2c06334ce3fe08f54

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