Skip to main content

Official Python SDK for Vylth Flow — self-custody crypto payment processing

Project description

vylth-flow

Official Python SDK for Vylth Flow — self-custody crypto payment processing.

PyPI Python

Install

pip install vylth-flow

Quick Start

from vylth_flow import Flow

flow = Flow(api_key="vf_live_...", webhook_secret="whsec_...")

# Create a payment invoice
invoice = flow.invoices.create(
    amount=100.00,
    currency="USDT",
    network="tron",
    description="Premium Plan",
    customer_email="buyer@example.com",
)
print(f"Pay to: {invoice.wallet_address}")
print(f"Status: {invoice.status}")

# Request a payout
payout = flow.payouts.create(
    amount=50.00,
    currency="USDT",
    network="tron",
    destination="TXyz...recipientAddress",
)
print(f"Payout ID: {payout.id}")

Async Support

from vylth_flow import AsyncFlow

async with AsyncFlow(api_key="vf_live_...") as flow:
    invoice = await flow.invoices.create(
        amount=100, currency="USDT", network="ethereum",
    )

Resources

Invoices

# Create
invoice = flow.invoices.create(amount=100, currency="USDT", network="tron")

# Get by ID
invoice = flow.invoices.get("inv_abc123")

# List with filters
result = flow.invoices.list(status="paid", page=1, limit=20)
for inv in result.items:
    print(inv.id, inv.amount, inv.status)

# Cancel
flow.invoices.cancel("inv_abc123")

Payouts

# Single payout
payout = flow.payouts.create(
    amount=50, currency="USDT", network="tron",
    destination="TXyz...addr",
)

# Batch payout
payouts = flow.payouts.create_batch([
    {"amount": 50, "currency": "USDT", "network": "tron", "destination_address": "TXyz..."},
    {"amount": 25, "currency": "USDT", "network": "tron", "destination_address": "TAbc..."},
])

# Check status
payout = flow.payouts.get("pout_abc123")

Wallets

# Generate a new deposit wallet
wallet = flow.wallets.generate(network="ethereum", currency="USDT")
print(wallet.address)

# List wallets
result = flow.wallets.list(network="tron")

# Check balance
wallet = flow.wallets.balance("wal_abc123")

Swaps

# Get a quote
quote = flow.swaps.quote("BTC", "USDT", amount=0.01)
print(f"Rate: {quote.rate}, You get: {quote.to_amount} USDT")

# Execute swap
swap = flow.swaps.create("BTC", "USDT", amount=0.01)

Webhooks

from vylth_flow import Flow, InvalidSignatureError

flow = Flow(api_key="vf_live_...", webhook_secret="whsec_...")

# In your webhook handler:
def handle_webhook(request):
    payload = request.body
    signature = request.headers["X-Flow-Signature"]

    try:
        event = flow.webhooks.verify(payload, signature)
    except InvalidSignatureError:
        return {"error": "Invalid signature"}, 400

    if event.type == "invoice.paid":
        invoice_id = event.data["id"]
        print(f"Invoice {invoice_id} paid!")

    return {"status": "ok"}

Error Handling

from vylth_flow import Flow, FlowError, AuthenticationError, RateLimitError

flow = Flow(api_key="vf_live_...")

try:
    invoice = flow.invoices.create(amount=100, currency="USDT", network="tron")
except AuthenticationError:
    print("Bad API key")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except FlowError as e:
    print(f"Error: {e.message} (code={e.code}, status={e.status})")

Configuration

flow = Flow(
    api_key="vf_live_...",
    webhook_secret="whsec_...",      # For webhook verification
    base_url="https://flow.vylth.com/api/flow",  # Default
    timeout=30.0,                     # Request timeout in seconds
)

Supported Networks

Bitcoin, Ethereum, Tron, BNB Chain, Solana, Ripple, Polygon, Avalanche, Dogecoin, Litecoin, TON, and more.

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

vylth_flow-0.4.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

vylth_flow-0.4.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file vylth_flow-0.4.1.tar.gz.

File metadata

  • Download URL: vylth_flow-0.4.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for vylth_flow-0.4.1.tar.gz
Algorithm Hash digest
SHA256 45555ca67880e4169f030bd002e83274d7c68a9e33093a3bdaadc086efd0a334
MD5 af2fb62d8b7f0056cc81d45c23512f1d
BLAKE2b-256 0ae6c993a90a3145fb876e421496004210521ad8766d6f6db1329a1a6f77de60

See more details on using hashes here.

File details

Details for the file vylth_flow-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: vylth_flow-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for vylth_flow-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f652a02ce7c806d7eb46fb779a60cb3291be42a2acc612c01d22a0ff04e56886
MD5 9756ca5887e749be5a845b847ae3b5d9
BLAKE2b-256 84cf5e63710b3abdb2a1a0447b188e3c7564dd03343577f33c8b0896af834829

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