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.0.tar.gz (11.8 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.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: devport-0.1.0.tar.gz
  • Upload date:
  • Size: 11.8 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.0.tar.gz
Algorithm Hash digest
SHA256 3d74838051fe34095883b6fb00abd6564255001a4dd6133b0c343a811c09ca00
MD5 0206ba34fe2db9b66af7aa9c4e72e17b
BLAKE2b-256 4c20a604cb3d7a4a94c69b66649070bf61eca4cc67640b9fe7048b9d65b0d2e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: devport-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 495fe777c8dd031c563cf9c8d4e7d593271ed6139c773d3225643e8312ee8ed6
MD5 e13c802b7d99b0c61ed3f08ee02eb89c
BLAKE2b-256 5c25637f5f80ce51eb47a3702bb9c7d0299ee1376e8cd8fe6de6d928542d9b48

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