Skip to main content

Overview

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

Type-Safe

Full TypeScript support with comprehensive type definitions

Promise-Based

Modern async/await API for clean, readable code

Comprehensive

Access to all Devdraft API endpoints and features

Easy Integration

Simple configuration and intuitive method names

Installation

npm i @devdraft/sdk
# or
yarn add @devdraft/sdk
# or
pnpm add @devdraft/sdk

Quick Start

import { Configuration, TransfersApi, WebhooksApi } from 'devdraft';

// Configure the SDK
const configuration = new Configuration({
  basePath: 'https://api.devdraft.ai',
  apiKey: (name: string) => {
    const keys: Record<string, string> = {
      'x-client-key': process.env.DEVDRAFT_CLIENT_KEY!,
      'x-client-secret': process.env.DEVDRAFT_CLIENT_SECRET!
    };
    return keys[name];
  }
});

// Initialize API clients
const transfersApi = new TransfersApi(configuration);
const webhooksApi = new WebhooksApi(configuration);

// Use the APIs
const transfer = await transfersApi.transferControllerCreateDirectWalletTransfer({
  createDirectWalletTransferDto: {
    walletId: 'your-wallet-id',
    network: 'solana',
    stableCoinCurrency: 'usdc',
    amount: 100.00
  }
});

API Classes

The SDK is organized into API classes, each handling a specific domain:
API ClassDescription
APIHealthApiService health checks and status monitoring
AppBalancesApiQuery application balances across stablecoins
CustomersApiCustomer management and KYC operations
ExchangeRatesApiReal-time currency exchange rates
InvoicesApiInvoice creation and management
LiquidationAddressesApiCryptocurrency liquidation addresses
PaymentIntentsApiPayment intent creation for bank and stablecoin
PaymentLinksApiGenerate and manage payment links
ProductsApiProduct catalog management
TaxesApiTax configuration and management
TestPaymentsApiTest payment processing in sandbox
TransfersApiInitiate and manage fund transfers
WalletsApiWallet management and balances
WebhooksApiWebhook configuration and management

API Health

Monitor service health and availability.

Methods

healthControllerCheckV0()

Authenticated health check endpoint requiring API credentials.
import { APIHealthApi } from 'devdraft';

const healthApi = new APIHealthApi(configuration);

try {
  await healthApi.healthControllerCheckV0();
  console.log('Service is healthy and authenticated');
} catch (error) {
  console.error('Health check failed:', error);
}
Returns: Promise<void>

healthControllerPublicHealthCheckV0()

Public health check endpoint (no authentication required).
const status = await healthApi.healthControllerPublicHealthCheckV0();
console.log('Service status:', status);
Returns: Promise<PublicHealthResponseDto>

App Balances

Query your application’s stablecoin balances.

Methods

balanceControllerGetAllBalances()

Get all stablecoin balances for your application.
import { AppBalancesApi } from 'devdraft';

const balancesApi = new AppBalancesApi(configuration);

const balances = await balancesApi.balanceControllerGetAllBalances();
console.log('USDC Balance:', balances.usdc);
console.log('EURC Balance:', balances.eurc);
Returns: Promise<AllBalancesResponse>

balanceControllerGetUSDCBalance()

Get USDC balance only.
const usdcBalance = await balancesApi.balanceControllerGetUSDCBalance();
console.log('USDC:', usdcBalance.amount);
Returns: Promise<AggregatedBalanceResponse>

balanceControllerGetEURCBalance()

Get EURC balance only.
const eurcBalance = await balancesApi.balanceControllerGetEURCBalance();
console.log('EURC:', eurcBalance.amount);
Returns: Promise<AggregatedBalanceResponse>

Customers

Manage customer records and KYC information.

Methods

customerControllerCreate(params)

Create a new customer.
import { CustomersApi, CreateCustomerDto } from 'devdraft';

const customersApi = new CustomersApi(configuration);

const newCustomer = await customersApi.customerControllerCreate({
  createCustomerDto: {
    firstName: 'John',
    lastName: 'Doe',
    email: 'john.doe@example.com',
    type: 'INDIVIDUAL',
    country: 'US'
  }
});

console.log('Customer created:', newCustomer.id);
Parameters:
  • createCustomerDto: CreateCustomerDto - Customer details
Returns: Promise<Customer>

customerControllerFindAll(params?)

Get all customers with optional filters.
const customers = await customersApi.customerControllerFindAll({
  page: 1,
  limit: 20,
  status: 'ACTIVE'
});

customers.forEach(customer => {
  console.log(`${customer.firstName} ${customer.lastName} - ${customer.email}`);
});
Parameters:
  • page?: number - Page number (default: 1)
  • limit?: number - Items per page (default: 20)
  • status?: CustomerStatus - Filter by status
Returns: Promise<Customer[]>

customerControllerFindOne(params)

Get a customer by ID.
const customer = await customersApi.customerControllerFindOne({
  id: 'customer-id-here'
});

console.log('Customer:', customer.firstName, customer.lastName);
Parameters:
  • id: string - Customer ID
Returns: Promise<Customer>

customerControllerUpdate(params)

Update a customer’s information.
const updated = await customersApi.customerControllerUpdate({
  id: 'customer-id-here',
  updateCustomerDto: {
    phone: '+1234567890',
    address: '123 Main St'
  }
});

console.log('Customer updated:', updated.id);
Parameters:
  • id: string - Customer ID
  • updateCustomerDto: UpdateCustomerDto - Fields to update
Returns: Promise<Customer>

Exchange Rates

Get real-time currency exchange rates.

Methods

exchangeRateControllerGetExchangeRate(params)

Get exchange rate between any two supported currencies.
import { ExchangeRatesApi } from 'devdraft';

const ratesApi = new ExchangeRatesApi(configuration);

const rate = await ratesApi.exchangeRateControllerGetExchangeRate({
  from: 'USD',
  to: 'EUR'
});

console.log(`1 USD = ${rate.rate} EUR`);
console.log(`Rate expires at: ${rate.expiresAt}`);
Parameters:
  • from: string - Source currency code
  • to: string - Target currency code
Returns: Promise<ExchangeRateResponseDto>

exchangeRateControllerGetUSDToEURRate()

Get USD to EUR exchange rate.
const usdToEur = await ratesApi.exchangeRateControllerGetUSDToEURRate();
console.log('USD to EUR:', usdToEur.rate);
Returns: Promise<ExchangeRateResponseDto>

exchangeRateControllerGetEURToUSDRate()

Get EUR to USD exchange rate.
const eurToUsd = await ratesApi.exchangeRateControllerGetEURToUSDRate();
console.log('EUR to USD:', eurToUsd.rate);
Returns: Promise<ExchangeRateResponseDto>

Invoices

Create and manage invoices for your customers.

Methods

invoiceControllerCreate(params)

Create a new invoice.
import { InvoicesApi, CreateInvoiceDto } from 'devdraft';

const invoicesApi = new InvoicesApi(configuration);

const invoice = await invoicesApi.invoiceControllerCreate({
  createInvoiceDto: {
    customerId: 'customer-id',
    items: [
      {
        description: 'Premium Subscription',
        quantity: 1,
        price: 99.99,
        currency: 'USD'
      }
    ],
    dueDate: '2024-12-31'
  }
});

console.log('Invoice created:', invoice.id);
console.log('Total:', invoice.total);
Parameters:
  • createInvoiceDto: CreateInvoiceDto - Invoice details
Returns: Promise<Invoice>

invoiceControllerFindAll(params?)

Get all invoices.
const invoices = await invoicesApi.invoiceControllerFindAll({
  page: 1,
  limit: 50,
  status: 'UNPAID'
});
Parameters:
  • page?: number - Page number
  • limit?: number - Items per page
  • status?: string - Filter by status
Returns: Promise<Invoice[]>

invoiceControllerFindOne(params)

Get an invoice by ID.
const invoice = await invoicesApi.invoiceControllerFindOne({
  id: 'invoice-id'
});
Parameters:
  • id: string - Invoice ID
Returns: Promise<Invoice>

invoiceControllerUpdate(params)

Update an invoice.
const updated = await invoicesApi.invoiceControllerUpdate({
  id: 'invoice-id',
  updateInvoiceDto: {
    status: 'PAID',
    paidAt: new Date().toISOString()
  }
});
Parameters:
  • id: string - Invoice ID
  • updateInvoiceDto: UpdateInvoiceDto - Fields to update
Returns: Promise<Invoice>

Liquidation Addresses

Manage cryptocurrency liquidation addresses for customers.

Methods

liquidationAddressControllerCreateLiquidationAddress(params)

Create a new liquidation address for a customer.
import { LiquidationAddressesApi } from 'devdraft';

const liquidationApi = new LiquidationAddressesApi(configuration);

const address = await liquidationApi.liquidationAddressControllerCreateLiquidationAddress({
  customerId: 'customer-id',
  createLiquidationAddressDto: {
    network: 'solana',
    currency: 'usdc'
  }
});

console.log('Liquidation address:', address.address);
console.log('Network:', address.network);
Parameters:
  • customerId: string - Customer ID
  • createLiquidationAddressDto: CreateLiquidationAddressDto - Address details
Returns: Promise<LiquidationAddressResponseDto>

liquidationAddressControllerGetLiquidationAddresses(params)

Get all liquidation addresses for a customer.
const addresses = await liquidationApi.liquidationAddressControllerGetLiquidationAddresses({
  customerId: 'customer-id'
});

addresses.forEach(addr => {
  console.log(`${addr.network}: ${addr.address}`);
});
Parameters:
  • customerId: string - Customer ID
Returns: Promise<LiquidationAddressResponseDto[]>

liquidationAddressControllerGetLiquidationAddress(params)

Get a specific liquidation address.
const address = await liquidationApi.liquidationAddressControllerGetLiquidationAddress({
  customerId: 'customer-id',
  liquidationAddressId: 'address-id'
});
Parameters:
  • customerId: string - Customer ID
  • liquidationAddressId: string - Address ID
Returns: Promise<LiquidationAddressResponseDto>

Payment Intents

Create payment intents for bank and stablecoin payments.

Methods

paymentIntentControllerCreateBankPaymentIntent(params)

Create a bank payment intent.
import { PaymentIntentsApi } from 'devdraft';

const intentApi = new PaymentIntentsApi(configuration);

const intent = await intentApi.paymentIntentControllerCreateBankPaymentIntent({
  createBankPaymentIntentDto: {
    customerId: 'customer-id',
    amount: 1000.00,
    currency: 'USD',
    paymentRail: 'wire'
  }
});

console.log('Payment intent:', intent.id);
console.log('Status:', intent.status);
Parameters:
  • createBankPaymentIntentDto: CreateBankPaymentIntentDto - Intent details
Returns: Promise<PaymentIntent>

paymentIntentControllerCreateStablePaymentIntent(params)

Create a stablecoin payment intent.
const stableIntent = await intentApi.paymentIntentControllerCreateStablePaymentIntent({
  createStablePaymentIntentDto: {
    customerId: 'customer-id',
    amount: 500.00,
    currency: 'usdc',
    network: 'solana'
  }
});
Parameters:
  • createStablePaymentIntentDto: CreateStablePaymentIntentDto - Intent details
Returns: Promise<PaymentIntent>
Generate and manage payment links for easy customer payments.

Methods

paymentLinksControllerCreate(params)

Create a new payment link.
import { PaymentLinksApi } from 'devdraft';

const linksApi = new PaymentLinksApi(configuration);

const link = await linksApi.paymentLinksControllerCreate({
  createPaymentLinkDto: {
    name: 'Product Purchase',
    amount: 99.99,
    currency: 'USD',
    products: [
      {
        name: 'Premium Plan',
        quantity: 1,
        price: 99.99
      }
    ]
  }
});

console.log('Payment link:', link.url);
console.log('Share this link with customers:', link.shortUrl);
Parameters:
  • createPaymentLinkDto: CreatePaymentLinkDto - Link details
Returns: Promise<PaymentLink>

paymentLinksControllerFindAll(params?)

Get all payment links.
const links = await linksApi.paymentLinksControllerFindAll({
  page: 1,
  limit: 20,
  active: true
});
Parameters:
  • page?: number - Page number
  • limit?: number - Items per page
  • active?: boolean - Filter by active status
Returns: Promise<PaymentLink[]>

paymentLinksControllerFindOne(params)

Get a payment link by ID.
const link = await linksApi.paymentLinksControllerFindOne({
  id: 'link-id'
});
Parameters:
  • id: string - Payment link ID
Returns: Promise<PaymentLink>

paymentLinksControllerUpdate(params)

Update a payment link.
const updated = await linksApi.paymentLinksControllerUpdate({
  id: 'link-id',
  updatePaymentLinkDto: {
    active: false,
    expiresAt: '2024-12-31T23:59:59Z'
  }
});
Parameters:
  • id: string - Payment link ID
  • updatePaymentLinkDto: UpdatePaymentLinkDto - Fields to update
Returns: Promise<PaymentLink>

Products

Manage your product catalog.

Methods

productControllerCreate(params)

Create a new product.
import { ProductsApi } from 'devdraft';

const productsApi = new ProductsApi(configuration);

const product = await productsApi.productControllerCreate({
  createProductDto: {
    name: 'Premium Subscription',
    description: 'Access to all premium features',
    price: 99.99,
    currency: 'USD',
    category: 'subscriptions'
  }
});

console.log('Product created:', product.id);
Parameters:
  • createProductDto: CreateProductDto - Product details
Returns: Promise<Product>

productControllerFindAll(params?)

Get all products.
const products = await productsApi.productControllerFindAll({
  category: 'subscriptions',
  active: true
});
Parameters:
  • category?: string - Filter by category
  • active?: boolean - Filter by active status
Returns: Promise<Product[]>

productControllerFindOne(params)

Get a product by ID.
const product = await productsApi.productControllerFindOne({
  id: 'product-id'
});
Parameters:
  • id: string - Product ID
Returns: Promise<Product>

productControllerUpdate(params)

Update a product.
const updated = await productsApi.productControllerUpdate({
  id: 'product-id',
  updateProductDto: {
    price: 89.99,
    description: 'Updated description'
  }
});
Parameters:
  • id: string - Product ID
  • updateProductDto: UpdateProductDto - Fields to update
Returns: Promise<Product>

productControllerRemove(params)

Delete a product.
await productsApi.productControllerRemove({
  id: 'product-id'
});
Parameters:
  • id: string - Product ID
Returns: Promise<void>

productControllerUploadImage(params)

Upload images for a product.
await productsApi.productControllerUploadImage({
  id: 'product-id',
  images: [file1, file2] // File objects
});
Parameters:
  • id: string - Product ID
  • images: File[] - Image files
Returns: Promise<Product>

Taxes

Configure and manage tax settings.

Methods

taxControllerCreate(params)

Create a new tax configuration.
import { TaxesApi } from 'devdraft';

const taxesApi = new TaxesApi(configuration);

const tax = await taxesApi.taxControllerCreate({
  createTaxDto: {
    name: 'Sales Tax',
    percentage: 8.5,
    country: 'US',
    state: 'CA'
  }
});

console.log('Tax created:', tax.id);
Parameters:
  • createTaxDto: CreateTaxDto - Tax details
Returns: Promise<Tax>

taxControllerFindAll(params?)

Get all tax configurations.
const taxes = await taxesApi.taxControllerFindAll({
  country: 'US'
});
Parameters:
  • country?: string - Filter by country
Returns: Promise<Tax[]>

taxControllerFindOne(params)

Get a tax configuration by ID.
const tax = await taxesApi.taxControllerFindOne({
  id: 'tax-id'
});
Parameters:
  • id: string - Tax ID
Returns: Promise<Tax>

taxControllerUpdate(params)

Update a tax configuration.
const updated = await taxesApi.taxControllerUpdate({
  id: 'tax-id',
  updateTaxDto: {
    percentage: 9.0
  }
});
Parameters:
  • id: string - Tax ID
  • updateTaxDto: UpdateTaxDto - Fields to update
Returns: Promise<Tax>

taxControllerRemove(params)

Delete a tax configuration.
await taxesApi.taxControllerRemove({
  id: 'tax-id'
});
Parameters:
  • id: string - Tax ID
Returns: Promise<void>

Test Payments

Process test payments in sandbox environment.

Methods

testPaymentControllerCreatePaymentV0(params)

Create a test payment.
import { TestPaymentsApi } from 'devdraft';

const testApi = new TestPaymentsApi(configuration);

const payment = await testApi.testPaymentControllerCreatePaymentV0({
  paymentRequestDto: {
    amount: 100.00,
    currency: 'USD',
    customerId: 'test-customer-id',
    idempotencyKey: 'unique-key-123'
  }
});

console.log('Test payment:', payment.id);
console.log('Status:', payment.status);
Parameters:
  • paymentRequestDto: PaymentRequestDto - Payment details
Returns: Promise<PaymentResponseDto>

testPaymentControllerGetPaymentV0(params)

Get test payment details by ID.
const payment = await testApi.testPaymentControllerGetPaymentV0({
  id: 'payment-id'
});

console.log('Payment status:', payment.status);
Parameters:
  • id: string - Payment ID
Returns: Promise<PaymentResponseDto>

testPaymentControllerRefundPaymentV0(params)

Refund a test payment.
const refund = await testApi.testPaymentControllerRefundPaymentV0({
  id: 'payment-id',
  refundAmount: 50.00
});

console.log('Refund processed:', refund.id);
Parameters:
  • id: string - Payment ID
  • refundAmount?: number - Amount to refund (optional, defaults to full amount)
Returns: Promise<RefundResponseDto>

Transfers

Initiate and manage fund transfers between different payment rails.

Methods

transferControllerCreateDirectBankTransfer(params)

Create a direct bank transfer.
import { TransfersApi } from 'devdraft';

const transfersApi = new TransfersApi(configuration);

const transfer = await transfersApi.transferControllerCreateDirectBankTransfer({
  createDirectBankTransferDto: {
    walletId: 'wallet-id',
    paymentRail: 'wire',
    sourceCurrency: 'usd',
    destinationCurrency: 'usdc',
    amount: 1000.00
  }
});

console.log('Transfer created:', transfer.id);
console.log('Bank instructions:', transfer.source_deposit_instructions);
Parameters:
  • createDirectBankTransferDto: CreateDirectBankTransferDto - Transfer details
Returns: Promise<Transfer> See also: Direct Bank Transfer Guide

transferControllerCreateDirectWalletTransfer(params)

Create a direct wallet transfer.
const transfer = await transfersApi.transferControllerCreateDirectWalletTransfer({
  createDirectWalletTransferDto: {
    walletId: 'wallet-id',
    network: 'solana',
    stableCoinCurrency: 'usdc',
    amount: 500.00
  }
});

console.log('Transfer created:', transfer.id);
console.log('Deposit address:', transfer.source_deposit_instructions.to_address);
Parameters:
  • createDirectWalletTransferDto: CreateDirectWalletTransferDto - Transfer details
Returns: Promise<Transfer> See also: Direct Wallet Transfer Guide

transferControllerCreateExternalBankTransfer(params)

Create an external bank transfer (from your wallet to external bank).
const transfer = await transfersApi.transferControllerCreateExternalBankTransfer({
  createExternalBankTransferDto: {
    sourceWalletId: 'wallet-id',
    destinationBankAccountId: 'bank-account-id',
    amount: 1000.00,
    currency: 'USD'
  }
});
Parameters:
  • createExternalBankTransferDto: CreateExternalBankTransferDto - Transfer details
Returns: Promise<Transfer>

transferControllerCreateExternalStablecoinTransfer(params)

Create an external stablecoin transfer (from your wallet to external wallet).
const transfer = await transfersApi.transferControllerCreateExternalStablecoinTransfer({
  createExternalStablecoinTransferDto: {
    sourceWalletId: 'wallet-id',
    destinationAddress: '0x742d35Cc6Ff82a8C2D8D1Da9da17c7eDfD5bE0a3',
    network: 'ethereum',
    currency: 'usdc',
    amount: 250.00
  }
});
Parameters:
  • createExternalStablecoinTransferDto: CreateExternalStablecoinTransferDto - Transfer details
Returns: Promise<Transfer>

transferControllerCreateStablecoinConversion(params)

Convert between different stablecoins or networks.
const conversion = await transfersApi.transferControllerCreateStablecoinConversion({
  createStablecoinConversionDto: {
    sourceWalletId: 'wallet-id',
    destinationWalletId: 'wallet-id',
    sourceNetwork: 'ethereum',
    destinationNetwork: 'solana',
    sourceCurrency: 'usdc',
    destinationCurrency: 'usdc',
    amount: 1000.00
  }
});

console.log('Conversion ID:', conversion.id);
console.log('Exchange rate:', conversion.exchange_rate.rate);
console.log('Estimated completion:', conversion.estimated_completion);
Parameters:
  • createStablecoinConversionDto: CreateStablecoinConversionDto - Conversion details
Returns: Promise<Conversion> See also: Stablecoin Conversion Guide

Wallets

Manage wallets and query balances.

Methods

walletControllerGetWallets()

Get all wallets for your application.
import { WalletsApi } from 'devdraft';

const walletsApi = new WalletsApi(configuration);

await walletsApi.walletControllerGetWallets();
// Returns wallet information for your application
Returns: Promise<void>
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(params)

Create a new webhook.
import { WebhooksApi } from 'devdraft';

const webhooksApi = new WebhooksApi(configuration);

const webhook = await webhooksApi.webhookControllerCreate({
  createWebhookDto: {
    url: 'https://your-app.com/webhooks/devdraft',
    name: 'Production Webhook',
    isActive: true,
    encrypted: false
  }
});

console.log('Webhook ID:', webhook.id);
console.log('Signing secret:', webhook.signingSecret);
Parameters:
  • createWebhookDto: CreateWebhookDto - Webhook configuration
Returns: Promise<WebhookResponseDto> See also: Webhooks Overview

webhookControllerFindAll(params?)

Get all webhooks.
const webhooks = await webhooksApi.webhookControllerFindAll({
  page: 1,
  limit: 20,
  active: true
});

webhooks.forEach(webhook => {
  console.log(`${webhook.name}: ${webhook.url}`);
  console.log(`Active: ${webhook.isActive}`);
});
Parameters:
  • page?: number - Page number
  • limit?: number - Items per page
  • active?: boolean - Filter by active status
Returns: Promise<WebhookResponseDto[]>

webhookControllerFindOne(params)

Get a webhook by ID.
const webhook = await webhooksApi.webhookControllerFindOne({
  id: 'webhook-id'
});

console.log('Webhook:', webhook.name);
console.log('URL:', webhook.url);
console.log('Delivery stats:', webhook.delivery_stats);
Parameters:
  • id: string - Webhook ID
Returns: Promise<WebhookResponseDto>

webhookControllerUpdate(params)

Update a webhook.
const updated = await webhooksApi.webhookControllerUpdate({
  id: 'webhook-id',
  updateWebhookDto: {
    url: 'https://your-app.com/webhooks/new-endpoint',
    isActive: true
  }
});
Parameters:
  • id: string - Webhook ID
  • updateWebhookDto: UpdateWebhookDto - Fields to update
Returns: Promise<WebhookResponseDto>

webhookControllerRemove(params)

Delete a webhook.
await webhooksApi.webhookControllerRemove({
  id: 'webhook-id'
});

console.log('Webhook deleted');
Parameters:
  • id: string - Webhook ID
Returns: Promise<void>

Error Handling

All SDK methods may throw errors. Handle them appropriately:
import { ResponseError } from 'devdraft';

try {
  await transfersApi.transferControllerCreateDirectWalletTransfer({
    createDirectWalletTransferDto: transferData
  });
} catch (error) {
  if (error instanceof ResponseError) {
    const status = error.response.status;
    const body = await error.response.json();
    
    switch (status) {
      case 400:
        console.error('Invalid request:', body.message);
        break;
      case 401:
        console.error('Authentication failed');
        break;
      case 404:
        console.error('Resource not found:', body.message);
        break;
      case 422:
        console.error('Validation error:', body.message);
        break;
      case 429:
        console.error('Rate limited');
        break;
      default:
        console.error('API error:', status, body);
    }
  } else {
    console.error('Unexpected error:', error);
  }
}

Type Definitions

The SDK includes comprehensive TypeScript types for all requests and responses. Import them as needed:
import type {
  CreateDirectWalletTransferDto,
  CreateDirectBankTransferDto,
  CreateWebhookDto,
  WebhookResponseDto,
  PaymentResponseDto,
  Customer,
  Invoice,
  // ... and many more
} from 'devdraft';

Best Practices

1

Use Environment Variables

Store API credentials in environment variables, never in source code.
const configuration = new Configuration({
  basePath: process.env.DEVDRAFT_API_URL || 'https://api.devdraft.ai',
  apiKey: (name: string) => {
    const keys: Record<string, string> = {
      'x-client-key': process.env.DEVDRAFT_CLIENT_KEY!,
      'x-client-secret': process.env.DEVDRAFT_CLIENT_SECRET!
    };
    return keys[name];
  }
});
2

Implement Proper Error Handling

Always wrap API calls in try-catch blocks and handle errors appropriately.
3

Use TypeScript

Leverage TypeScript’s type system to catch errors at compile time.
// TypeScript will catch type errors
const transfer: CreateDirectWalletTransferDto = {
  walletId: 'wallet-id',
  network: 'solana', // TypeScript ensures this is a valid network
  stableCoinCurrency: 'usdc',
  amount: 100.00
};
4

Reuse Configuration

Create a single Configuration instance and reuse it across multiple API clients.
const config = new Configuration({ /* ... */ });

const transfersApi = new TransfersApi(config);
const webhooksApi = new WebhooksApi(config);
const customersApi = new CustomersApi(config);
5

Handle Async Operations

Use async/await for clean, readable code.
async function processPayment() {
  try {
    const payment = await testApi.testPaymentControllerCreatePaymentV0({
      paymentRequestDto: paymentData
    });
    
    const status = await testApi.testPaymentControllerGetPaymentV0({
      id: payment.id
    });
    
    return status;
  } catch (error) {
    handleError(error);
  }
}

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