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.1.tar.gz (8.0 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.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fkwallet_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 8.0 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.1.tar.gz
Algorithm Hash digest
SHA256 fae1b464787dd64d35d301ea2742cea4a4c7bbf7e960e7f28eef495b0769943f
MD5 439ef0dc180c60383e76c0727672854a
BLAKE2b-256 85a8a955973aea747e85ce35042ec7ef17a49b8cea6af23f90da37f38e749980

See more details on using hashes here.

Provenance

The following attestation bundles were made for fkwallet_sdk-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: fkwallet_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ba0988b564da551f2aefda50504db571549af04ebe717e830ac0781b46f6f01
MD5 0b6c37aa95fe23065b66a11dffc4d012
BLAKE2b-256 ea389d1dfdd2531b2c8d413a41d2577fea41bc6e39a2281b6f76d80d6b4563ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for fkwallet_sdk-0.1.1-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