Overview
The Devdraft Go SDK provides a complete client library for integrating payment processing, customer management, and webhook functionality into your Go applications.Type-Safe
Strong typing with Go’s type system and struct tags
Context-Aware
Built-in support for Go’s context package for cancellation and timeouts
Comprehensive
Access to all Devdraft API endpoints and features
Idiomatic Go
Follows Go best practices and conventions
Installation
Requirements
- Go 1.19 or higher
Quick Start
API Services
The SDK is organized into API services, each handling a specific domain:API Health
Monitor service health and availability.Methods
HealthControllerCheckV0(ctx)
Authenticated health check endpoint requiring API credentials.
ctx: context.Context- Context for cancellation and timeouts
(*http.Response, error)
HealthControllerPublicHealthCheckV0(ctx)
Public health check endpoint (no authentication required).
ctx: context.Context- Context for cancellation and timeouts
(*PublicHealthResponseDto, *http.Response, error)
App Balances
Query your application’s stablecoin balances.Methods
BalanceControllerGetAllBalances(ctx)
Get all stablecoin balances for your application.
ctx: context.Context- Context for cancellation and timeouts
(*AllBalancesResponse, *http.Response, error)
BalanceControllerGetUSDCBalance(ctx)
Get USDC balance only.
ctx: context.Context- Context for cancellation and timeouts
(*AggregatedBalanceResponse, *http.Response, error)
BalanceControllerGetEURCBalance(ctx)
Get EURC balance only.
ctx: context.Context- Context for cancellation and timeouts
(*AggregatedBalanceResponse, *http.Response, error)
Customers
Manage customer records and KYC information.Methods
CustomerControllerCreate(ctx)
Create a new customer.
ctx: context.Context- Context for cancellation and timeouts
(*Customer, *http.Response, error)
CustomerControllerFindAll(ctx)
Get all customers with optional filters.
ctx: context.Context- Context for cancellation and timeoutsPage(*int32)- Page number (optional, default: 1)Limit(*int32)- Items per page (optional, default: 20)Status(*string)- Filter by status (optional)
([]Customer, *http.Response, error)
CustomerControllerFindOne(ctx, id)
Get a customer by ID.
ctx: context.Context- Context for cancellation and timeoutsid: string- Customer ID
(*Customer, *http.Response, error)
CustomerControllerUpdate(ctx, id)
Update a customer’s information.
ctx: context.Context- Context for cancellation and timeoutsid: string- Customer ID
(*Customer, *http.Response, error)
Exchange Rates
Get real-time currency exchange rates.Methods
ExchangeRateControllerGetExchangeRate(ctx)
Get exchange rate between any two supported currencies.
ctx: context.Context- Context for cancellation and timeoutsFrom(*string)- Source currency codeTo(*string)- Target currency code
(*ExchangeRateResponseDto, *http.Response, error)
ExchangeRateControllerGetUSDToEURRate(ctx)
Get USD to EUR exchange rate.
ctx: context.Context- Context for cancellation and timeouts
(*ExchangeRateResponseDto, *http.Response, error)
ExchangeRateControllerGetEURToUSDRate(ctx)
Get EUR to USD exchange rate.
ctx: context.Context- Context for cancellation and timeouts
(*ExchangeRateResponseDto, *http.Response, error)
Invoices
Create and manage invoices for your customers.Methods
InvoiceControllerCreate(ctx)
Create a new invoice.
ctx: context.Context- Context for cancellation and timeouts
(*Invoice, *http.Response, error)
InvoiceControllerFindAll(ctx)
Get all invoices.
ctx: context.Context- Context for cancellation and timeoutsPage(*int32)- Page number (optional)Limit(*int32)- Items per page (optional)Status(*string)- Filter by status (optional)
([]Invoice, *http.Response, error)
InvoiceControllerFindOne(ctx, id)
Get an invoice by ID.
ctx: context.Context- Context for cancellation and timeoutsid: string- Invoice ID
(*Invoice, *http.Response, error)
InvoiceControllerUpdate(ctx, id)
Update an invoice.
ctx: context.Context- Context for cancellation and timeoutsid: string- Invoice ID
(*Invoice, *http.Response, error)
Liquidation Addresses
Manage cryptocurrency liquidation addresses for customers.Methods
LiquidationAddressControllerCreateLiquidationAddress(ctx, customerId)
Create a new liquidation address for a customer.
ctx: context.Context- Context for cancellation and timeoutscustomerId: string- Customer ID
(*LiquidationAddressResponseDto, *http.Response, error)
LiquidationAddressControllerGetLiquidationAddresses(ctx, customerId)
Get all liquidation addresses for a customer.
ctx: context.Context- Context for cancellation and timeoutscustomerId: string- Customer ID
([]LiquidationAddressResponseDto, *http.Response, error)
LiquidationAddressControllerGetLiquidationAddress(ctx, customerId, liquidationAddressId)
Get a specific liquidation address.
ctx: context.Context- Context for cancellation and timeoutscustomerId: string- Customer IDliquidationAddressId: string- Address ID
(*LiquidationAddressResponseDto, *http.Response, error)
Payment Intents
Create payment intents for bank and stablecoin payments.Methods
PaymentIntentControllerCreateBankPaymentIntent(ctx)
Create a bank payment intent.
ctx: context.Context- Context for cancellation and timeouts
(*PaymentIntent, *http.Response, error)
PaymentIntentControllerCreateStablePaymentIntent(ctx)
Create a stablecoin payment intent.
ctx: context.Context- Context for cancellation and timeouts
(*PaymentIntent, *http.Response, error)
Payment Links
Generate and manage payment links for easy customer payments.Methods
PaymentLinksControllerCreate(ctx)
Create a new payment link.
ctx: context.Context- Context for cancellation and timeouts
(*PaymentLink, *http.Response, error)
PaymentLinksControllerFindAll(ctx)
Get all payment links.
ctx: context.Context- Context for cancellation and timeoutsPage(*int32)- Page number (optional)Limit(*int32)- Items per page (optional)Active(*bool)- Filter by active status (optional)
([]PaymentLink, *http.Response, error)
PaymentLinksControllerFindOne(ctx, id)
Get a payment link by ID.
ctx: context.Context- Context for cancellation and timeoutsid: string- Payment link ID
(*PaymentLink, *http.Response, error)
PaymentLinksControllerUpdate(ctx, id)
Update a payment link.
ctx: context.Context- Context for cancellation and timeoutsid: string- Payment link ID
(*PaymentLink, *http.Response, error)
Transfers
Initiate and manage fund transfers between different payment rails.Methods
TransferControllerCreateDirectBankTransfer(ctx)
Create a direct bank transfer.
ctx: context.Context- Context for cancellation and timeouts
(*Transfer, *http.Response, error)
See also: Direct Bank Transfer Guide
TransferControllerCreateDirectWalletTransfer(ctx)
Create a direct wallet transfer.
ctx: context.Context- Context for cancellation and timeouts
(*Transfer, *http.Response, error)
See also: Direct Wallet Transfer Guide
TransferControllerCreateExternalBankTransfer(ctx)
Create an external bank transfer (from your wallet to external bank).
ctx: context.Context- Context for cancellation and timeouts
(*Transfer, *http.Response, error)
TransferControllerCreateExternalStablecoinTransfer(ctx)
Create an external stablecoin transfer (from your wallet to external wallet).
ctx: context.Context- Context for cancellation and timeouts
(*Transfer, *http.Response, error)
TransferControllerCreateStablecoinConversion(ctx)
Convert between different stablecoins or networks.
ctx: context.Context- Context for cancellation and timeouts
(*Conversion, *http.Response, error)
See also: Stablecoin Conversion Guide
Wallets
Manage wallets and query balances.Methods
WalletControllerGetWallets(ctx)
Get all wallets for your application.
ctx: context.Context- Context for cancellation and timeouts
(*http.Response, error)
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
WebhookControllerCreate(ctx)
Create a new webhook.
ctx: context.Context- Context for cancellation and timeouts
(*WebhookResponseDto, *http.Response, error)
See also: Webhooks Overview
WebhookControllerFindAll(ctx)
Get all webhooks.
ctx: context.Context- Context for cancellation and timeoutsPage(*int32)- Page number (optional)Limit(*int32)- Items per page (optional)Active(*bool)- Filter by active status (optional)
([]WebhookResponseDto, *http.Response, error)
WebhookControllerFindOne(ctx, id)
Get a webhook by ID.
ctx: context.Context- Context for cancellation and timeoutsid: string- Webhook ID
(*WebhookResponseDto, *http.Response, error)
WebhookControllerUpdate(ctx, id)
Update a webhook.
ctx: context.Context- Context for cancellation and timeoutsid: string- Webhook ID
(*WebhookResponseDto, *http.Response, error)
WebhookControllerRemove(ctx, id)
Delete a webhook.
ctx: context.Context- Context for cancellation and timeoutsid: string- Webhook ID
(*http.Response, error)
Error Handling
All SDK methods return errors as the last return value. Handle them appropriately:Helper Functions
The SDK provides helper functions for creating pointers to primitive types:Best Practices
1
Use Context with Timeout
Always use context with timeout for API calls to prevent hanging requests.
2
Always Close Response Bodies
Use defer to ensure response bodies are closed to prevent resource leaks.
3
Environment Variables for Credentials
Store API credentials in environment variables, never in source code.
4
Check Both Error and Response
Always check both the error and response status code for complete error handling.
5
Reuse Client Instances
Create a single API client instance and reuse it across your application.
6
Use Pointer Helper Functions
Use the SDK’s pointer helper functions for cleaner code.
Testing
Example test using Go’s testing package:Concurrency
The SDK is safe for concurrent use. You can make multiple API calls concurrently: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
