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 statementComprehensive
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.
None
health_controller_public_health_check_v0()
Public health check endpoint (no authentication required).
PublicHealthResponseDto
App Balances
Query your application’s stablecoin balances.Methods
balance_controller_get_all_balances()
Get all stablecoin balances for your application.
AllBalancesResponse
balance_controller_get_usdc_balance()
Get USDC balance only.
AggregatedBalanceResponse
balance_controller_get_eurc_balance()
Get EURC balance only.
AggregatedBalanceResponse
Customers
Manage customer records and KYC information.Methods
customer_controller_create(create_customer_dto)
Create a new customer.
create_customer_dto: CreateCustomerDto- Customer details
Customer
customer_controller_find_all(**kwargs)
Get all customers with optional filters.
page: int- Page number (optional, default: 1)limit: int- Items per page (optional, default: 20)status: str- Filter by status (optional)
List[Customer]
customer_controller_find_one(id)
Get a customer by ID.
id: str- Customer ID
Customer
customer_controller_update(id, update_customer_dto)
Update a customer’s information.
id: str- Customer IDupdate_customer_dto: UpdateCustomerDto- Fields to update
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.
var_from: str- Source currency codeto: str- Target currency code
ExchangeRateResponseDto
exchange_rate_controller_get_usdto_eur_rate()
Get USD to EUR exchange rate.
ExchangeRateResponseDto
exchange_rate_controller_get_eurto_usd_rate()
Get EUR to USD exchange rate.
ExchangeRateResponseDto
Invoices
Create and manage invoices for your customers.Methods
invoice_controller_create(create_invoice_dto)
Create a new invoice.
create_invoice_dto: CreateInvoiceDto- Invoice details
Invoice
invoice_controller_find_all(**kwargs)
Get all invoices.
page: int- Page number (optional)limit: int- Items per page (optional)status: str- Filter by status (optional)
List[Invoice]
invoice_controller_find_one(id)
Get an invoice by ID.
id: str- Invoice ID
Invoice
invoice_controller_update(id, update_invoice_dto)
Update an invoice.
id: str- Invoice IDupdate_invoice_dto: dict- Fields to update
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.
customer_id: str- Customer IDcreate_liquidation_address_dto: CreateLiquidationAddressDto- Address details
LiquidationAddressResponseDto
liquidation_address_controller_get_liquidation_addresses(customer_id)
Get all liquidation addresses for a customer.
customer_id: str- Customer ID
List[LiquidationAddressResponseDto]
liquidation_address_controller_get_liquidation_address(customer_id, liquidation_address_id)
Get a specific liquidation address.
customer_id: str- Customer IDliquidation_address_id: str- Address ID
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.
create_bank_payment_intent_dto: CreateBankPaymentIntentDto- Intent details
PaymentIntent
payment_intent_controller_create_stable_payment_intent(create_stable_payment_intent_dto)
Create a stablecoin payment intent.
create_stable_payment_intent_dto: CreateStablePaymentIntentDto- Intent details
PaymentIntent
Payment Links
Generate and manage payment links for easy customer payments.Methods
payment_links_controller_create(create_payment_link_dto)
Create a new payment link.
create_payment_link_dto: CreatePaymentLinkDto- Link details
PaymentLink
payment_links_controller_find_all(**kwargs)
Get all payment links.
page: int- Page number (optional)limit: int- Items per page (optional)active: bool- Filter by active status (optional)
List[PaymentLink]
payment_links_controller_find_one(id)
Get a payment link by ID.
id: str- Payment link ID
PaymentLink
payment_links_controller_update(id, update_payment_link_dto)
Update a payment link.
id: str- Payment link IDupdate_payment_link_dto: dict- Fields to update
PaymentLink
Products
Manage your product catalog.Methods
product_controller_create(create_product_dto)
Create a new product.
create_product_dto: dict- Product details
Product
product_controller_find_all(**kwargs)
Get all products.
category: str- Filter by category (optional)active: bool- Filter by active status (optional)
List[Product]
product_controller_find_one(id)
Get a product by ID.
id: str- Product ID
Product
product_controller_update(id, update_product_dto)
Update a product.
id: str- Product IDupdate_product_dto: dict- Fields to update
Product
product_controller_remove(id)
Delete a product.
id: str- Product ID
None
product_controller_upload_image(id, images)
Upload images for a product.
id: str- Product IDimages: List[file]- Image files
Product
Taxes
Configure and manage tax settings.Methods
tax_controller_create(create_tax_dto)
Create a new tax configuration.
create_tax_dto: CreateTaxDto- Tax details
Tax
tax_controller_find_all(**kwargs)
Get all tax configurations.
country: str- Filter by country (optional)
List[Tax]
tax_controller_find_one(id)
Get a tax configuration by ID.
id: str- Tax ID
Tax
tax_controller_update(id, update_tax_dto)
Update a tax configuration.
id: str- Tax IDupdate_tax_dto: UpdateTaxDto- Fields to update
Tax
tax_controller_remove(id)
Delete a tax configuration.
id: str- Tax ID
None
Test Payments
Process test payments in sandbox environment.Methods
test_payment_controller_create_payment_v0(payment_request_dto)
Create a test payment.
payment_request_dto: PaymentRequestDto- Payment details
PaymentResponseDto
test_payment_controller_get_payment_v0(id)
Get test payment details by ID.
id: str- Payment ID
PaymentResponseDto
test_payment_controller_refund_payment_v0(id, **kwargs)
Refund a test payment.
id: str- Payment IDrefund_amount: float- Amount to refund (optional, defaults to full amount)
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.
create_direct_bank_transfer_dto: CreateDirectBankTransferDto- Transfer details
Transfer
See also: Direct Bank Transfer Guide
transfer_controller_create_direct_wallet_transfer(create_direct_wallet_transfer_dto)
Create a direct wallet transfer.
create_direct_wallet_transfer_dto: CreateDirectWalletTransferDto- Transfer details
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).
create_external_bank_transfer_dto: CreateExternalBankTransferDto- Transfer details
Transfer
transfer_controller_create_external_stablecoin_transfer(create_external_stablecoin_transfer_dto)
Create an external stablecoin transfer (from your wallet to external wallet).
create_external_stablecoin_transfer_dto: CreateExternalStablecoinTransferDto- Transfer details
Transfer
transfer_controller_create_stablecoin_conversion(create_stablecoin_conversion_dto)
Convert between different stablecoins or networks.
create_stablecoin_conversion_dto: CreateStablecoinConversionDto- Conversion details
Conversion
See also: Stablecoin Conversion Guide
Wallets
Manage wallets and query balances.Methods
wallet_controller_get_wallets()
Get all wallets for your application.
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.
create_webhook_dto: CreateWebhookDto- Webhook configuration
WebhookResponseDto
See also: Webhooks Overview
webhook_controller_find_all(**kwargs)
Get all webhooks.
page: int- Page number (optional)limit: int- Items per page (optional)active: bool- Filter by active status (optional)
List[WebhookResponseDto]
webhook_controller_find_one(id)
Get a webhook by ID.
id: str- Webhook ID
WebhookResponseDto
webhook_controller_update(id, update_webhook_dto)
Update a webhook.
id: str- Webhook IDupdate_webhook_dto: UpdateWebhookDto- Fields to update
WebhookResponseDto
webhook_controller_remove(id)
Delete a webhook.
id: str- Webhook ID
None
Error Handling
All SDK methods may throwApiException. 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 useaiohttp 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
