Skip to main content

Python SDK for FKWallet API

Project description

fkwallet-sdk

Async Python SDK for the FKWallet API.

Features

  • ✅ Fully async (httpx + async/await)
  • ✅ Pydantic v2 models with full type hints
  • ✅ SHA-256 request signing (GET & POST)
  • ✅ Webhook signature verification
  • ✅ Custom exceptions
  • ✅ Typed status enums with helper properties

Installation

pip install fkwallet-sdk

Or with Poetry:

poetry add fkwallet-sdk

Quick Start

import asyncio
from fkwallet import FKWalletClient

async def main():
    async with FKWalletClient(
        public_key="YOUR_PUBLIC_KEY",
        private_key="YOUR_PRIVATE_KEY",
    ) as client:
        balance = await client.get_balance()
        print(f"Balance: {balance.value} {balance.currency_code}")

asyncio.run(main())

API Reference

FKWalletClient

All methods are async and must be used inside an async with block.

Method Description
get_balance() Current wallet balance
get_history(date_from, date_to, page, limit) Transaction history
get_currencies() List supported currencies
get_payment_systems() List payment systems
get_sbp_list() List SBP banks
get_mobile_carrier_list() List mobile carriers
create_withdrawal(request) Create withdrawal order
get_withdrawal_status(order_id, type) Get withdrawal status
create_transfer(request) Transfer to another wallet
get_transfer(id) Get transfer status
get_op_categories() Online product categories
get_op_products(category_id) Products in a category
create_op_order(request) Purchase online product
get_op_status(order_id) Online product order status

Webhook Verification

from fkwallet.webhook import verify_webhook

# In your web framework:
form_data = dict(await request.form())
verify_webhook(form_data, private_key="YOUR_PRIVATE_KEY")
# Raises FKWalletWebhookError on invalid signature

Status Enums

from fkwallet import WithdrawalStatus

status = WithdrawalStatus(2)
status.is_processing  # True
status.is_terminal    # False
status.is_error       # False

Error Handling

from fkwallet import FKWalletAPIError

try:
    result = await client.create_withdrawal(...)
except FKWalletAPIError as e:
    print(e.message, e.status_code, e.raw)

Development

poetry install
poetry run pytest tests/ -v

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

fkwallet_sdk-0.1.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

fkwallet_sdk-0.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fkwallet_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f0f6176f7871d043865d78758690269b5b912919444fd8b085e21d5809b2f072
MD5 f4d3cbece1e5ae6588fd7b1ca4be1a9a
BLAKE2b-256 dacc9d042ed7ac009ef07f5ef3cb0b1030be63c0f860ee32366cc0e7faabd903

See more details on using hashes here.

Provenance

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

Publisher: upload.yml on forestsnet/fkwallet-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 fkwallet_sdk-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for fkwallet_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09605cb097c234c6c272b245be7c5373f52ba9a5dd12a49d4334281d370bd9b8
MD5 97b64bdac9d9752e0206344a523d3058
BLAKE2b-256 36525d342c56a90872d050816731c5c3e8e49eeee4df64a128a9f46bd05f4e15

See more details on using hashes here.

Provenance

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

Publisher: upload.yml on forestsnet/fkwallet-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