Overview
The Devdraft Ruby SDK provides a complete client library for integrating payment processing, customer management, and webhook functionality into your Ruby applications.Ruby Idioms
Follows Ruby conventions with blocks, symbols, and elegant syntax
Gem Package
Easy installation via RubyGems package manager
Comprehensive
Access to all Devdraft API endpoints and features
Rails Compatible
Works seamlessly with Ruby on Rails applications
Installation
Using Bundler
Add to yourGemfile:
Using RubyGems
Install from Source
Requirements
- Ruby 2.7 or higher
Quick Start
API Classes
The SDK is organized into API classes under theDevdraft module:
API Health
Monitor service health and availability.Methods
health_controller_check_v0()
Authenticated health check endpoint requiring API credentials.
nil
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(opts = {})
Get all customers with optional filters.
opts: Hash- Optional parameterspage: Integer- Page number (default: 1)limit: Integer- Items per page (default: 20)status: String- Filter by status
Array<Customer>
customer_controller_find_one(id)
Get a customer by ID.
id: String- Customer ID
Customer
customer_controller_update(id, update_customer_dto)
Update a customer’s information.
id: String- Customer IDupdate_customer_dto: UpdateCustomerDto- Fields to update
Customer
Exchange Rates
Get real-time currency exchange rates.Methods
exchange_rate_controller_get_exchange_rate(opts = {})
Get exchange rate between any two supported currencies.
opts: Hash- Optional parametersfrom: String- Source currency codeto: String- 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(opts = {})
Get all invoices.
opts: Hash- Optional parameterspage: Integer- Page numberlimit: Integer- Items per pagestatus: String- Filter by status
Array<Invoice>
invoice_controller_find_one(id)
Get an invoice by ID.
id: String- Invoice ID
Invoice
invoice_controller_update(id, update_invoice_dto)
Update an invoice.
id: String- Invoice IDupdate_invoice_dto: Hash- 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: String- 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: String- Customer ID
Array<LiquidationAddressResponseDto>
liquidation_address_controller_get_liquidation_address(customer_id, liquidation_address_id)
Get a specific liquidation address.
customer_id: String- Customer IDliquidation_address_id: String- 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(opts = {})
Get all payment links.
opts: Hash- Optional parameterspage: Integer- Page numberlimit: Integer- Items per pageactive: Boolean- Filter by active status
Array<PaymentLink>
payment_links_controller_find_one(id)
Get a payment link by ID.
id: String- Payment link ID
PaymentLink
payment_links_controller_update(id, update_payment_link_dto)
Update a payment link.
id: String- Payment link IDupdate_payment_link_dto: Hash- Fields to update
PaymentLink
Products
Manage your product catalog.Methods
product_controller_create(create_product_dto)
Create a new product.
create_product_dto: Hash- Product details
Product
product_controller_find_all(opts = {})
Get all products.
opts: Hash- Optional parameterscategory: String- Filter by categoryactive: Boolean- Filter by active status
Array<Product>
product_controller_find_one(id)
Get a product by ID.
id: String- Product ID
Product
product_controller_update(id, update_product_dto)
Update a product.
id: String- Product IDupdate_product_dto: Hash- Fields to update
Product
product_controller_remove(id)
Delete a product.
id: String- Product ID
nil
product_controller_upload_image(id, images)
Upload images for a product.
id: String- Product IDimages: Array<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(opts = {})
Get all tax configurations.
opts: Hash- Optional parameterscountry: String- Filter by country
Array<Tax>
tax_controller_find_one(id)
Get a tax configuration by ID.
id: String- Tax ID
Tax
tax_controller_update(id, update_tax_dto)
Update a tax configuration.
id: String- Tax IDupdate_tax_dto: UpdateTaxDto- Fields to update
Tax
tax_controller_remove(id)
Delete a tax configuration.
id: String- Tax ID
nil
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: String- Payment ID
PaymentResponseDto
test_payment_controller_refund_payment_v0(id, opts = {})
Refund a test payment.
id: String- Payment IDopts: Hash- Optional parametersrefund_amount: Float- Amount to refund (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.
nil
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(opts = {})
Get all webhooks.
opts: Hash- Optional parameterspage: Integer- Page numberlimit: Integer- Items per pageactive: Boolean- Filter by active status
Array<WebhookResponseDto>
webhook_controller_find_one(id)
Get a webhook by ID.
id: String- Webhook ID
WebhookResponseDto
webhook_controller_update(id, update_webhook_dto)
Update a webhook.
id: String- Webhook IDupdate_webhook_dto: UpdateWebhookDto- Fields to update
WebhookResponseDto
webhook_controller_remove(id)
Delete a webhook.
id: String- Webhook ID
nil
Error Handling
All SDK methods may raiseDevdraft::ApiError. Handle them appropriately:
Best Practices
1
Use Configuration Block
Set up configuration once at the start of your application.
2
Use Environment Variables
Store credentials in environment variables, never in source code.
3
Proper Exception Handling
Always wrap API calls in begin/rescue blocks.
4
Use Symbols for Hash Keys
Follow Ruby conventions by using symbols for hash keys.
5
Use Blocks for Iteration
Use Ruby blocks for clean iteration over collections.
6
Implement Logging
Use Ruby’s built-in Logger or Rails logger.
Testing with RSpec
Example RSpec test for SDK integration:Rails Integration
Configuration
Create an initializer for Rails applications:Service Object Pattern
Create service objects for cleaner Rails integration:Controller Example
Use the service in your Rails controllers:Background Jobs
Process API calls in background jobs: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
