Skip to main content

Overview

The Devdraft Python SDK provides a complete client library for integrating payment processing, customer management, and webhook functionality into your Python applications.

Pythonic API

Follows Python conventions with snake_case naming and type hints

Context Manager Support

Clean resource management with Python’s with statement

Comprehensive

Access to all Devdraft API endpoints and features

Easy Integration

Simple configuration and intuitive method names

Installation

Requirements

  • Python 3.9 or higher

Quick Start

API Classes

The SDK is organized into API classes, each handling a specific domain:

API Health

Monitor service health and availability.

Methods

health_controller_check_v0()

Authenticated health check endpoint requiring API credentials.
Returns: None

health_controller_public_health_check_v0()

Public health check endpoint (no authentication required).
Returns: PublicHealthResponseDto

App Balances

Query your application’s stablecoin balances.

Methods

balance_controller_get_all_balances()

Get all stablecoin balances for your application.
Returns: AllBalancesResponse

balance_controller_get_usdc_balance()

Get USDC balance only.
Returns: AggregatedBalanceResponse

balance_controller_get_eurc_balance()

Get EURC balance only.
Returns: AggregatedBalanceResponse

Customers

Manage customer records and KYC information.

Methods

customer_controller_create(create_customer_dto)

Create a new customer.
Parameters:
  • create_customer_dto: CreateCustomerDto - Customer details
Returns: Customer

customer_controller_find_all(**kwargs)

Get all customers with optional filters.
Parameters:
  • page: int - Page number (optional, default: 1)
  • limit: int - Items per page (optional, default: 20)
  • status: str - Filter by status (optional)
Returns: List[Customer]

customer_controller_find_one(id)

Get a customer by ID.
Parameters:
  • id: str - Customer ID
Returns: Customer

customer_controller_update(id, update_customer_dto)

Update a customer’s information.
Parameters:
  • id: str - Customer ID
  • update_customer_dto: UpdateCustomerDto - Fields to update
Returns: Customer

Exchange Rates

Get real-time currency exchange rates.

Methods

exchange_rate_controller_get_exchange_rate(**kwargs)

Get exchange rate between any two supported currencies.
Parameters:
  • var_from: str - Source currency code
  • to: str - Target currency code
Returns: ExchangeRateResponseDto

exchange_rate_controller_get_usdto_eur_rate()

Get USD to EUR exchange rate.
Returns: ExchangeRateResponseDto

exchange_rate_controller_get_eurto_usd_rate()

Get EUR to USD exchange rate.
Returns: ExchangeRateResponseDto

Invoices

Create and manage invoices for your customers.

Methods

invoice_controller_create(create_invoice_dto)

Create a new invoice.
Parameters:
  • create_invoice_dto: CreateInvoiceDto - Invoice details
Returns: Invoice

invoice_controller_find_all(**kwargs)

Get all invoices.
Parameters:
  • page: int - Page number (optional)
  • limit: int - Items per page (optional)
  • status: str - Filter by status (optional)
Returns: List[Invoice]

invoice_controller_find_one(id)

Get an invoice by ID.
Parameters:
  • id: str - Invoice ID
Returns: Invoice

invoice_controller_update(id, update_invoice_dto)

Update an invoice.
Parameters:
  • id: str - Invoice ID
  • update_invoice_dto: dict - Fields to update
Returns: Invoice

Liquidation Addresses

Manage cryptocurrency liquidation addresses for customers.

Methods

liquidation_address_controller_create_liquidation_address(customer_id, create_liquidation_address_dto)

Create a new liquidation address for a customer.
Parameters:
  • customer_id: str - Customer ID
  • create_liquidation_address_dto: CreateLiquidationAddressDto - Address details
Returns: LiquidationAddressResponseDto

liquidation_address_controller_get_liquidation_addresses(customer_id)

Get all liquidation addresses for a customer.
Parameters:
  • customer_id: str - Customer ID
Returns: List[LiquidationAddressResponseDto]

liquidation_address_controller_get_liquidation_address(customer_id, liquidation_address_id)

Get a specific liquidation address.
Parameters:
  • customer_id: str - Customer ID
  • liquidation_address_id: str - Address ID
Returns: LiquidationAddressResponseDto

Payment Intents

Create payment intents for bank and stablecoin payments.

Methods

payment_intent_controller_create_bank_payment_intent(create_bank_payment_intent_dto)

Create a bank payment intent.
Parameters:
  • create_bank_payment_intent_dto: CreateBankPaymentIntentDto - Intent details
Returns: PaymentIntent

payment_intent_controller_create_stable_payment_intent(create_stable_payment_intent_dto)

Create a stablecoin payment intent.
Parameters:
  • create_stable_payment_intent_dto: CreateStablePaymentIntentDto - Intent details
Returns: PaymentIntent
Generate and manage payment links for easy customer payments.

Methods

Create a new payment link.
Parameters:
  • create_payment_link_dto: CreatePaymentLinkDto - Link details
Returns: PaymentLink Get all payment links.
Parameters:
  • page: int - Page number (optional)
  • limit: int - Items per page (optional)
  • active: bool - Filter by active status (optional)
Returns: List[PaymentLink] Get a payment link by ID.
Parameters:
  • id: str - Payment link ID
Returns: PaymentLink Update a payment link.
Parameters:
  • id: str - Payment link ID
  • update_payment_link_dto: dict - Fields to update
Returns: PaymentLink

Products

Manage your product catalog.

Methods

product_controller_create(create_product_dto)

Create a new product.
Parameters:
  • create_product_dto: dict - Product details
Returns: Product

product_controller_find_all(**kwargs)

Get all products.
Parameters:
  • category: str - Filter by category (optional)
  • active: bool - Filter by active status (optional)
Returns: List[Product]

product_controller_find_one(id)

Get a product by ID.
Parameters:
  • id: str - Product ID
Returns: Product

product_controller_update(id, update_product_dto)

Update a product.
Parameters:
  • id: str - Product ID
  • update_product_dto: dict - Fields to update
Returns: Product

product_controller_remove(id)

Delete a product.
Parameters:
  • id: str - Product ID
Returns: None

product_controller_upload_image(id, images)

Upload images for a product.
Parameters:
  • id: str - Product ID
  • images: List[file] - Image files
Returns: Product

Taxes

Configure and manage tax settings.

Methods

tax_controller_create(create_tax_dto)

Create a new tax configuration.
Parameters:
  • create_tax_dto: CreateTaxDto - Tax details
Returns: Tax

tax_controller_find_all(**kwargs)

Get all tax configurations.
Parameters:
  • country: str - Filter by country (optional)
Returns: List[Tax]

tax_controller_find_one(id)

Get a tax configuration by ID.
Parameters:
  • id: str - Tax ID
Returns: Tax

tax_controller_update(id, update_tax_dto)

Update a tax configuration.
Parameters:
  • id: str - Tax ID
  • update_tax_dto: UpdateTaxDto - Fields to update
Returns: Tax

tax_controller_remove(id)

Delete a tax configuration.
Parameters:
  • id: str - Tax ID
Returns: None

Test Payments

Process test payments in sandbox environment.

Methods

test_payment_controller_create_payment_v0(payment_request_dto)

Create a test payment.
Parameters:
  • payment_request_dto: PaymentRequestDto - Payment details
Returns: PaymentResponseDto

test_payment_controller_get_payment_v0(id)

Get test payment details by ID.
Parameters:
  • id: str - Payment ID
Returns: PaymentResponseDto

test_payment_controller_refund_payment_v0(id, **kwargs)

Refund a test payment.
Parameters:
  • id: str - Payment ID
  • refund_amount: float - Amount to refund (optional, defaults to full amount)
Returns: RefundResponseDto

Transfers

Initiate and manage fund transfers between different payment rails.

Methods

transfer_controller_create_direct_bank_transfer(create_direct_bank_transfer_dto)

Create a direct bank transfer.
Parameters:
  • create_direct_bank_transfer_dto: CreateDirectBankTransferDto - Transfer details
Returns: Transfer See also: Direct Bank Transfer Guide

transfer_controller_create_direct_wallet_transfer(create_direct_wallet_transfer_dto)

Create a direct wallet transfer.
Parameters:
  • create_direct_wallet_transfer_dto: CreateDirectWalletTransferDto - Transfer details
Returns: Transfer See also: Direct Wallet Transfer Guide

transfer_controller_create_external_bank_transfer(create_external_bank_transfer_dto)

Create an external bank transfer (from your wallet to external bank).
Parameters:
  • create_external_bank_transfer_dto: CreateExternalBankTransferDto - Transfer details
Returns: Transfer

transfer_controller_create_external_stablecoin_transfer(create_external_stablecoin_transfer_dto)

Create an external stablecoin transfer (from your wallet to external wallet).
Parameters:
  • create_external_stablecoin_transfer_dto: CreateExternalStablecoinTransferDto - Transfer details
Returns: Transfer

transfer_controller_create_stablecoin_conversion(create_stablecoin_conversion_dto)

Convert between different stablecoins or networks.
Parameters:
  • create_stablecoin_conversion_dto: CreateStablecoinConversionDto - Conversion details
Returns: Conversion See also: Stablecoin Conversion Guide

Wallets

Manage wallets and query balances.

Methods

wallet_controller_get_wallets()

Get all wallets for your application.
Returns: None
The response contains wallet IDs that you can use for transfers and other operations. In a future SDK version, this will return typed wallet objects.

Webhooks

Configure webhooks to receive real-time event notifications.

Methods

webhook_controller_create(create_webhook_dto)

Create a new webhook.
Parameters:
  • create_webhook_dto: CreateWebhookDto - Webhook configuration
Returns: WebhookResponseDto See also: Webhooks Overview

webhook_controller_find_all(**kwargs)

Get all webhooks.
Parameters:
  • page: int - Page number (optional)
  • limit: int - Items per page (optional)
  • active: bool - Filter by active status (optional)
Returns: List[WebhookResponseDto]

webhook_controller_find_one(id)

Get a webhook by ID.
Parameters:
  • id: str - Webhook ID
Returns: WebhookResponseDto

webhook_controller_update(id, update_webhook_dto)

Update a webhook.
Parameters:
  • id: str - Webhook ID
  • update_webhook_dto: UpdateWebhookDto - Fields to update
Returns: WebhookResponseDto

webhook_controller_remove(id)

Delete a webhook.
Parameters:
  • id: str - Webhook ID
Returns: None

Error Handling

All SDK methods may throw ApiException. Handle them appropriately:

Type Hints

The SDK includes type hints for better IDE support and type checking:

Best Practices

1

Use Context Managers

Always use with statements to ensure proper resource cleanup.
2

Environment Variables for Credentials

Store API credentials in environment variables, never in source code.
3

Proper Exception Handling

Always wrap API calls in try-except blocks.
4

Use Type Hints

Leverage Python’s type hints for better code quality.
5

Reuse ApiClient

Create a single configuration and ApiClient instance and reuse it.
6

Use Logging for Debugging

Enable logging for debugging API calls.

Testing with Pytest

Example pytest test for SDK integration:

Async Support

For async/await support, you can use aiohttp with the SDK:

Next Steps

SDK Quickstart

Complete integration guide with examples

Transfers

Learn about initiating transfers

Webhooks

Set up webhook notifications

API Reference

Complete REST API documentation