Skip to main content

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.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*http.Response, error)

HealthControllerPublicHealthCheckV0(ctx)

Public health check endpoint (no authentication required).
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*PublicHealthResponseDto, *http.Response, error)

App Balances

Query your application’s stablecoin balances.

Methods

BalanceControllerGetAllBalances(ctx)

Get all stablecoin balances for your application.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*AllBalancesResponse, *http.Response, error)

BalanceControllerGetUSDCBalance(ctx)

Get USDC balance only.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*AggregatedBalanceResponse, *http.Response, error)

BalanceControllerGetEURCBalance(ctx)

Get EURC balance only.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*AggregatedBalanceResponse, *http.Response, error)

Customers

Manage customer records and KYC information.

Methods

CustomerControllerCreate(ctx)

Create a new customer.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*Customer, *http.Response, error)

CustomerControllerFindAll(ctx)

Get all customers with optional filters.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • Page(*int32) - Page number (optional, default: 1)
  • Limit(*int32) - Items per page (optional, default: 20)
  • Status(*string) - Filter by status (optional)
Returns: ([]Customer, *http.Response, error)

CustomerControllerFindOne(ctx, id)

Get a customer by ID.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Customer ID
Returns: (*Customer, *http.Response, error)

CustomerControllerUpdate(ctx, id)

Update a customer’s information.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Customer ID
Returns: (*Customer, *http.Response, error)

Exchange Rates

Get real-time currency exchange rates.

Methods

ExchangeRateControllerGetExchangeRate(ctx)

Get exchange rate between any two supported currencies.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • From(*string) - Source currency code
  • To(*string) - Target currency code
Returns: (*ExchangeRateResponseDto, *http.Response, error)

ExchangeRateControllerGetUSDToEURRate(ctx)

Get USD to EUR exchange rate.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*ExchangeRateResponseDto, *http.Response, error)

ExchangeRateControllerGetEURToUSDRate(ctx)

Get EUR to USD exchange rate.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*ExchangeRateResponseDto, *http.Response, error)

Invoices

Create and manage invoices for your customers.

Methods

InvoiceControllerCreate(ctx)

Create a new invoice.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*Invoice, *http.Response, error)

InvoiceControllerFindAll(ctx)

Get all invoices.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • Page(*int32) - Page number (optional)
  • Limit(*int32) - Items per page (optional)
  • Status(*string) - Filter by status (optional)
Returns: ([]Invoice, *http.Response, error)

InvoiceControllerFindOne(ctx, id)

Get an invoice by ID.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Invoice ID
Returns: (*Invoice, *http.Response, error)

InvoiceControllerUpdate(ctx, id)

Update an invoice.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Invoice ID
Returns: (*Invoice, *http.Response, error)

Liquidation Addresses

Manage cryptocurrency liquidation addresses for customers.

Methods

LiquidationAddressControllerCreateLiquidationAddress(ctx, customerId)

Create a new liquidation address for a customer.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • customerId: string - Customer ID
Returns: (*LiquidationAddressResponseDto, *http.Response, error)

LiquidationAddressControllerGetLiquidationAddresses(ctx, customerId)

Get all liquidation addresses for a customer.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • customerId: string - Customer ID
Returns: ([]LiquidationAddressResponseDto, *http.Response, error)

LiquidationAddressControllerGetLiquidationAddress(ctx, customerId, liquidationAddressId)

Get a specific liquidation address.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • customerId: string - Customer ID
  • liquidationAddressId: string - Address ID
Returns: (*LiquidationAddressResponseDto, *http.Response, error)

Payment Intents

Create payment intents for bank and stablecoin payments.

Methods

PaymentIntentControllerCreateBankPaymentIntent(ctx)

Create a bank payment intent.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*PaymentIntent, *http.Response, error)

PaymentIntentControllerCreateStablePaymentIntent(ctx)

Create a stablecoin payment intent.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*PaymentIntent, *http.Response, error)
Generate and manage payment links for easy customer payments.

Methods

PaymentLinksControllerCreate(ctx)

Create a new payment link.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*PaymentLink, *http.Response, error)

PaymentLinksControllerFindAll(ctx)

Get all payment links.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • Page(*int32) - Page number (optional)
  • Limit(*int32) - Items per page (optional)
  • Active(*bool) - Filter by active status (optional)
Returns: ([]PaymentLink, *http.Response, error)

PaymentLinksControllerFindOne(ctx, id)

Get a payment link by ID.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Payment link ID
Returns: (*PaymentLink, *http.Response, error)

PaymentLinksControllerUpdate(ctx, id)

Update a payment link.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Payment link ID
Returns: (*PaymentLink, *http.Response, error)

Transfers

Initiate and manage fund transfers between different payment rails.

Methods

TransferControllerCreateDirectBankTransfer(ctx)

Create a direct bank transfer.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*Transfer, *http.Response, error) See also: Direct Bank Transfer Guide

TransferControllerCreateDirectWalletTransfer(ctx)

Create a direct wallet transfer.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*Transfer, *http.Response, error) See also: Direct Wallet Transfer Guide

TransferControllerCreateExternalBankTransfer(ctx)

Create an external bank transfer (from your wallet to external bank).
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*Transfer, *http.Response, error)

TransferControllerCreateExternalStablecoinTransfer(ctx)

Create an external stablecoin transfer (from your wallet to external wallet).
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*Transfer, *http.Response, error)

TransferControllerCreateStablecoinConversion(ctx)

Convert between different stablecoins or networks.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*Conversion, *http.Response, error) See also: Stablecoin Conversion Guide

Wallets

Manage wallets and query balances.

Methods

WalletControllerGetWallets(ctx)

Get all wallets for your application.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*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.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
Returns: (*WebhookResponseDto, *http.Response, error) See also: Webhooks Overview

WebhookControllerFindAll(ctx)

Get all webhooks.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • Page(*int32) - Page number (optional)
  • Limit(*int32) - Items per page (optional)
  • Active(*bool) - Filter by active status (optional)
Returns: ([]WebhookResponseDto, *http.Response, error)

WebhookControllerFindOne(ctx, id)

Get a webhook by ID.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Webhook ID
Returns: (*WebhookResponseDto, *http.Response, error)

WebhookControllerUpdate(ctx, id)

Update a webhook.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Webhook ID
Returns: (*WebhookResponseDto, *http.Response, error)

WebhookControllerRemove(ctx, id)

Delete a webhook.
Parameters:
  • ctx: context.Context - Context for cancellation and timeouts
  • id: string - Webhook ID
Returns: (*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