Skip to main content

Official Python SDK for the Felloh payment API

Project description

Felloh Python SDK

Official Python SDK for the Felloh payment API.

Installation

pip install felloh

Quick Start

import asyncio
from felloh import FellohClient
from felloh.types import FellohConfig

client = FellohClient(FellohConfig(
    public_key="your_public_key",
    private_key="your_private_key",
))

async def main():
    # List bookings
    bookings = await client.bookings.list({"organisation": "org-id"})
    print(bookings["data"])

    # Create a booking
    booking = await client.bookings.create({
        "organisation": "org-id",
        "booking_reference": "REF-001",
        "customer_name": "Jane Smith",
        "email": "jane@example.com",
    })
    print(booking["data"]["id"])

    await client.close()

asyncio.run(main())

Context Manager

async with FellohClient(FellohConfig(
    public_key="your_public_key",
    private_key="your_private_key",
)) as client:
    bookings = await client.bookings.list({"organisation": "org-id"})

Pagination

Iterate through all results automatically:

from felloh import to_array

# Async iteration
async for booking in client.bookings.list_all({"organisation": "org-id"}):
    print(booking["id"])

# Or collect all into a list
all_bookings = await to_array(client.bookings.list_all({"organisation": "org-id"}))

Resources

Resource Methods
organisations list
bookings list, list_all, get, create, update, delete, update_reference
booking_components create, delete
transactions list, list_all, get, refund, complete, reverse, reassign
customers list, list_all, create
payment_links list, list_all, get, create, delete, assign
ecommerce list, list_all, get, create, delete, assign
refunds list, list_all, authorise, decline
charges list, list_all
chargebacks list, list_all
credit_notes list, list_all, get, create, assign
suppliers list, list_all, create
beneficiaries list, list_all, create, activate
disbursements list, list_all, get
ledger list, list_all
batches list, list_all, get
api_keys list, create, delete
audit list, list_all
aisp accounts, transactions, statistics
scheduled_payments list, list_all, available_tokens, create_payment, approval_link, delete
enums list

Error Handling

from felloh import (
    FellohError,
    FellohAuthenticationError,
    FellohNotFoundError,
    FellohValidationError,
    FellohRateLimitError,
    FellohServerError,
    FellohNetworkError,
)

try:
    await client.bookings.get("nonexistent-id")
except FellohNotFoundError as e:
    print(f"Not found: {e}")
except FellohAuthenticationError:
    print("Invalid credentials")
except FellohError as e:
    print(f"API error {e.status_code}: {e}")

Webhook Verification

from felloh import verify_webhook_signature, assert_webhook_signature

# Returns True/False
is_valid = verify_webhook_signature(
    payload=request_body,
    signature=request.headers["X-Signature"],
    secret="your_webhook_secret",
)

# Or raise FellohWebhookSignatureError
assert_webhook_signature(
    payload=request_body,
    signature=request.headers["X-Signature"],
    secret="your_webhook_secret",
)

Configuration

FellohConfig(
    public_key="pk_...",
    private_key="sk_...",
    base_url="https://api.felloh.com",       # default
    timeout=30.0,                              # seconds, default
    max_retries=2,                             # default
    token_refresh_buffer=60,                   # seconds before expiry, default
    logger=lambda entry: print(entry),         # optional request logger
)

Development

pip install -e ".[dev]"
pytest                              # unit + resource tests
pytest -m integration               # integration tests (requires env vars)

Integration tests require:

  • FELLOH_PUBLIC_KEY
  • FELLOH_PRIVATE_KEY
  • FELLOH_ORGANISATION_ID

License

MIT

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

felloh-0.1.0.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

felloh-0.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: felloh-0.1.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for felloh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a1f77ec937bfc6b3cf57fb4dcecb527de9699683a70dfc9e10e3d86fcb6154f0
MD5 1b0b4a899e1e7dc979b860edf025c4ad
BLAKE2b-256 22b5a6f1b16ef1c8b0cc36449885767203dd2549d5e84e3edccea610059143c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for felloh-0.1.0.tar.gz:

Publisher: publish.yml on felloh-org/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: felloh-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for felloh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28cd067a8467bde9445af2aa8316fb5413f75d709bcdbd5ba14f2e5d493d5d55
MD5 92437a5aca4599d2e2c5b8f9f5deb939
BLAKE2b-256 44e768b6fef38c4a15d6b5adbe4a048cf2ba293b90b5f09197e34f7ca0035fcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for felloh-0.1.0-py3-none-any.whl:

Publisher: publish.yml on felloh-org/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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