Skip to main content

Official Python SDK for the Blindpay API — Global payments infrastructure

Project description

Blindpay Python SDK

Official Python SDK for Blindpay API - Global payments infrastructure.

Installation

pip install blindpay

Requirements

  • Python 3.12 or higher
  • httpx
  • pydantic

Quick Start

import asyncio
from blindpay import BlindPay

async def main():
    # Initialize the client
    client = BlindPay(
        api_key="your-api-key",
        instance_id="your-instance-id"
    )
    
    # List available countries
    response = await client.available["countries"]()
    if response["error"]:
        print(f"Error: {response['error']['message']}")
    else:
        print(f"Countries: {response['data']}")
    
    # Create a receiver
    response = await client.receivers["create"](
        type="individual",
        kyc_type="light",
        email="john.doe@example.com",
        first_name="John",
        last_name="Doe",
        # ... other fields
    )
    
    # Close the client when done
    await client.close()

# Run the async function
asyncio.run(main())

Resources

The SDK provides access to the following resources:

Available

# Get available rails
await client.available["get_rails"]()

# Get bank details
await client.available["get_bank_details"]()

Instances

# Get instance details
await client.instances["get"]()

# Update instance
await client.instances["update"](name="New Name")

# API Keys
await client.instances["api_keys"]["list"]()
await client.instances["api_keys"]["create"](name="API Key Name", permission="full_access")
await client.instances["api_keys"]["get"]("api-key-id")
await client.instances["api_keys"]["delete"]("api-key-id")

# Webhook Endpoints
await client.instances["webhook_endpoints"]["list"]()
await client.instances["webhook_endpoints"]["create"](url="https://example.com/webhook")
await client.instances["webhook_endpoints"]["get"]("webhook-id")
await client.instances["webhook_endpoints"]["update"]("webhook-id", enabled=False)
await client.instances["webhook_endpoints"]["delete"]("webhook-id")

Receivers

# List receivers
await client.receivers["list"]()

# Create a receiver
await client.receivers["create"](
    type="individual",
    kyc_type="light",
    email="john.doe@example.com",
    first_name="John",
    last_name="Doe",
    # ... other fields
)

# Get a receiver
await client.receivers["get"]("receiver-id")

# Update a receiver
await client.receivers["update"]("receiver-id", email="new.email@example.com")

# Delete a receiver
await client.receivers["delete"]("receiver-id")

# Submit KYC
await client.receivers["submit_kyc"]("receiver-id")

# Bank Accounts
await client.receivers["bank_accounts"]["list"]("receiver-id")
await client.receivers["bank_accounts"]["create"]("receiver-id", type="pix", pix_key="key")
await client.receivers["bank_accounts"]["get"]("receiver-id", "bank-account-id")
await client.receivers["bank_accounts"]["update"]("receiver-id", "bank-account-id", name="New Name")
await client.receivers["bank_accounts"]["delete"]("receiver-id", "bank-account-id")

Quotes

# Create a quote
await client.quotes["create"](
    bank_account_id="bank-account-id",
    currency_type="receiver",
    request_amount=1000,
    cover_fees=False,
    # ... other fields
)

# Get FX rate
await client.quotes["get_fx_rate"](
    currency_type="sender",
    from_currency="USD",
    to="BRL",
    request_amount=1000
)

Payins

# List payins
await client.payins["list"]()

# Get a payin
await client.payins["get"]("payin-id")

# Get payin tracking
await client.payins["get_track"]("payin-id")

# Export payins
await client.payins["export"](status="completed")

# Create EVM payin
await client.payins["create_evm"]("payin-quote-id")

# Payin Quotes
await client.payins["quotes"]["create"](
    receiver_id="receiver-id",
    bank_account_id="bank-account-id",
    # ... other fields
)
await client.payins["quotes"]["get"]("quote-id")

Payouts

# List payouts
await client.payouts["list"]()

# Create a payout
await client.payouts["create"](
    bank_account_id="bank-account-id",
    amount=1000,
    # ... other fields
)

# Get a payout
await client.payouts["get"]("payout-id")

# Get payout tracking
await client.payouts["get_track"]("payout-id")

# Export payouts
await client.payouts["export"](status="completed")

Virtual Accounts

# List virtual accounts
await client.virtual_accounts["list"]()

# Create a virtual account
await client.virtual_accounts["create"](
    name="Account Name",
    # ... other fields
)

# Get a virtual account
await client.virtual_accounts["get"]("virtual-account-id")

# Get balance
await client.virtual_accounts["get_balance"]("virtual-account-id")

# List transactions
await client.virtual_accounts["list_transactions"]("virtual-account-id")

# Update a virtual account
await client.virtual_accounts["update"]("virtual-account-id", name="New Name")

# Delete a virtual account
await client.virtual_accounts["delete"]("virtual-account-id")

Wallets

Blockchain Wallets

# List blockchain wallets
await client.wallets["blockchain"]["list"]("receiver-id")

# Create with address
await client.wallets["blockchain"]["create_with_address"](
    receiver_id="receiver-id",
    name="Wallet Name",
    network="ethereum",
    address="0x..."
)

# Create with hash
await client.wallets["blockchain"]["create_with_hash"](
    receiver_id="receiver-id",
    name="Wallet Name",
    network="ethereum",
    signature_tx_hash="0x..."
)

# Get wallet message
await client.wallets["blockchain"]["get_wallet_message"]("receiver-id")

# Get a wallet
await client.wallets["blockchain"]["get"]("receiver-id", "wallet-id")

# Delete a wallet
await client.wallets["blockchain"]["delete"]("receiver-id", "wallet-id")

Offramp Wallets

# List offramp wallets
await client.wallets["offramp"]["list"]("receiver-id")

# Create an offramp wallet
await client.wallets["offramp"]["create"](
    receiver_id="receiver-id",
    name="Wallet Name",
    network="ethereum",
    address="0x..."
)

# Get an offramp wallet
await client.wallets["offramp"]["get"]("receiver-id", "wallet-id")

# Delete an offramp wallet
await client.wallets["offramp"]["delete"]("receiver-id", "wallet-id")

Partner Fees

# List partner fees
await client.partner_fees["list"]()

# Create a partner fee
await client.partner_fees["create"](
    name="Fee Name",
    percentage=0.01,
    # ... other fields
)

# Get a partner fee
await client.partner_fees["get"]("partner-fee-id")

# Update a partner fee
await client.partner_fees["update"]("partner-fee-id", percentage=0.02)

# Delete a partner fee
await client.partner_fees["delete"]("partner-fee-id")

Webhook Signature Verification

from blindpay import BlindPay

client = BlindPay(
    api_key="your-api-key",
    instance_id="your-instance-id"
)

# Verify webhook signature
is_valid = client.verify_webhook_signature(
    secret="your-webhook-secret",
    id="svix-id-header-value",
    timestamp="svix-timestamp-header-value",
    payload="raw-request-body",
    svix_signature="svix-signature-header-value"
)

if is_valid:
    print("Webhook signature is valid")
else:
    print("Invalid webhook signature")

Error Handling

All API methods return a response dictionary with either data or error:

response = await client.receivers["get"]("receiver-id")

if response["error"]:
    print(f"Error: {response['error']['message']}")
else:
    receiver = response["data"]
    print(f"Receiver: {receiver}")

Types

The SDK includes comprehensive type definitions for all API resources and parameters. These can be imported from the main package:

from blindpay import (
    AccountClass,
    BankAccountType,
    Country,
    Currency,
    CurrencyType,
    Network,
    Rail,
    StablecoinToken,
    TransactionDocumentType,
    TransactionStatus,
    PaginationParams,
    PaginationMetadata,
    # ... and more
)

Development

This SDK uses:

  • uv for package management
  • httpx for async HTTP requests
  • pydantic for data validation

License

MIT

Support

For support, please contact gabriel@blindpay.com or visit https://blindpay.com

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

alves_blindpay-1.0.1.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

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

alves_blindpay-1.0.1-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file alves_blindpay-1.0.1.tar.gz.

File metadata

  • Download URL: alves_blindpay-1.0.1.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.0

File hashes

Hashes for alves_blindpay-1.0.1.tar.gz
Algorithm Hash digest
SHA256 61eedddbaacdf61b01cf7f93df6b0cf97819a180685a3fcb6aabe7f71cf71044
MD5 0b9eddfb59ca7b047c1fe2771ac6a21a
BLAKE2b-256 ed5ec9858a4c5bae41aa32e391c234f9de0f0e024057c79e4c95cbc5907dd13e

See more details on using hashes here.

File details

Details for the file alves_blindpay-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for alves_blindpay-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a01a2959e9d803deaddb29984e3f1b8470c361ddff2b2baafe1f4ab9875bde7
MD5 8a0128915b447ec17d16c6b78305793a
BLAKE2b-256 221c92e8dc09dada4b2226723b0ea31642c9d493aeec96aacf8127e85f33bddb

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