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

Quick Start

API Classes

The SDK is organized into API classes, each handling a specific domain:

API Health

Monitor service health and availability.

Methods

healthControllerCheckV0()

Authenticated health check endpoint requiring API credentials.
Returns: Promise<void>

healthControllerPublicHealthCheckV0()

Public health check endpoint (no authentication required).
Returns: Promise<PublicHealthResponseDto>

App Balances

Query your application’s stablecoin balances.

Methods

balanceControllerGetAllBalances()

Get all stablecoin balances for your application.
Returns: Promise<AllBalancesResponse>

balanceControllerGetUSDCBalance()

Get USDC balance only.
Returns: Promise<AggregatedBalanceResponse>

balanceControllerGetEURCBalance()

Get EURC balance only.
Returns: Promise<AggregatedBalanceResponse>

Customers

Manage customer records and KYC information.

Methods

customerControllerCreate(params)

Create a new customer.
Parameters:
  • createCustomerDto: CreateCustomerDto - Customer details
Returns: Promise<Customer>

customerControllerFindAll(params?)

Get all customers with optional filters.
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.
Parameters:
  • id: string - Customer ID
Returns: Promise<Customer>

customerControllerUpdate(params)

Update a customer’s information.
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.
Parameters:
  • from: string - Source currency code
  • to: string - Target currency code
Returns: Promise<ExchangeRateResponseDto>

exchangeRateControllerGetUSDToEURRate()

Get USD to EUR exchange rate.
Returns: Promise<ExchangeRateResponseDto>

exchangeRateControllerGetEURToUSDRate()

Get EUR to USD exchange rate.
Returns: Promise<ExchangeRateResponseDto>

Invoices

Create and manage invoices for your customers.

Methods

invoiceControllerCreate(params)

Create a new invoice.
Parameters:
  • createInvoiceDto: CreateInvoiceDto - Invoice details
Returns: Promise<Invoice>

invoiceControllerFindAll(params?)

Get all invoices.
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.
Parameters:
  • id: string - Invoice ID
Returns: Promise<Invoice>

invoiceControllerUpdate(params)

Update an invoice.
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.
Parameters:
  • customerId: string - Customer ID
  • createLiquidationAddressDto: CreateLiquidationAddressDto - Address details
Returns: Promise<LiquidationAddressResponseDto>

liquidationAddressControllerGetLiquidationAddresses(params)

Get all liquidation addresses for a customer.
Parameters:
  • customerId: string - Customer ID
Returns: Promise<LiquidationAddressResponseDto[]>

liquidationAddressControllerGetLiquidationAddress(params)

Get a specific liquidation address.
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.
Parameters:
  • createBankPaymentIntentDto: CreateBankPaymentIntentDto - Intent details
Returns: Promise<PaymentIntent>

paymentIntentControllerCreateStablePaymentIntent(params)

Create a stablecoin payment intent.
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.
Parameters:
  • createPaymentLinkDto: CreatePaymentLinkDto - Link details
Returns: Promise<PaymentLink>

paymentLinksControllerFindAll(params?)

Get all payment links.
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.
Parameters:
  • id: string - Payment link ID
Returns: Promise<PaymentLink>

paymentLinksControllerUpdate(params)

Update a payment link.
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.
Parameters:
  • createProductDto: CreateProductDto - Product details
Returns: Promise<Product>

productControllerFindAll(params?)

Get all products.
Parameters:
  • category?: string - Filter by category
  • active?: boolean - Filter by active status
Returns: Promise<Product[]>

productControllerFindOne(params)

Get a product by ID.
Parameters:
  • id: string - Product ID
Returns: Promise<Product>

productControllerUpdate(params)

Update a product.
Parameters:
  • id: string - Product ID
  • updateProductDto: UpdateProductDto - Fields to update
Returns: Promise<Product>

productControllerRemove(params)

Delete a product.
Parameters:
  • id: string - Product ID
Returns: Promise<void>

productControllerUploadImage(params)

Upload images for a product.
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.
Parameters:
  • createTaxDto: CreateTaxDto - Tax details
Returns: Promise<Tax>

taxControllerFindAll(params?)

Get all tax configurations.
Parameters:
  • country?: string - Filter by country
Returns: Promise<Tax[]>

taxControllerFindOne(params)

Get a tax configuration by ID.
Parameters:
  • id: string - Tax ID
Returns: Promise<Tax>

taxControllerUpdate(params)

Update a tax configuration.
Parameters:
  • id: string - Tax ID
  • updateTaxDto: UpdateTaxDto - Fields to update
Returns: Promise<Tax>

taxControllerRemove(params)

Delete a tax configuration.
Parameters:
  • id: string - Tax ID
Returns: Promise<void>

Test Payments

Process test payments in sandbox environment.

Methods

testPaymentControllerCreatePaymentV0(params)

Create a test payment.
Parameters:
  • paymentRequestDto: PaymentRequestDto - Payment details
Returns: Promise<PaymentResponseDto>

testPaymentControllerGetPaymentV0(params)

Get test payment details by ID.
Parameters:
  • id: string - Payment ID
Returns: Promise<PaymentResponseDto>

testPaymentControllerRefundPaymentV0(params)

Refund a test payment.
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.
Parameters:
  • createDirectBankTransferDto: CreateDirectBankTransferDto - Transfer details
Returns: Promise<Transfer> See also: Direct Bank Transfer Guide

transferControllerCreateDirectWalletTransfer(params)

Create a direct wallet transfer.
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).
Parameters:
  • createExternalBankTransferDto: CreateExternalBankTransferDto - Transfer details
Returns: Promise<Transfer>

transferControllerCreateExternalStablecoinTransfer(params)

Create an external stablecoin transfer (from your wallet to external wallet).
Parameters:
  • createExternalStablecoinTransferDto: CreateExternalStablecoinTransferDto - Transfer details
Returns: Promise<Transfer>

transferControllerCreateStablecoinConversion(params)

Convert between different stablecoins or networks.
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.
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.
Parameters:
  • createWebhookDto: CreateWebhookDto - Webhook configuration
Returns: Promise<WebhookResponseDto> See also: Webhooks Overview

webhookControllerFindAll(params?)

Get all webhooks.
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.
Parameters:
  • id: string - Webhook ID
Returns: Promise<WebhookResponseDto>

webhookControllerUpdate(params)

Update a webhook.
Parameters:
  • id: string - Webhook ID
  • updateWebhookDto: UpdateWebhookDto - Fields to update
Returns: Promise<WebhookResponseDto>

webhookControllerRemove(params)

Delete a webhook.
Parameters:
  • id: string - Webhook ID
Returns: Promise<void>

Error Handling

All SDK methods may throw errors. Handle them appropriately:

Type Definitions

The SDK includes comprehensive TypeScript types for all requests and responses. Import them as needed:

Best Practices

1

Use Environment Variables

Store API credentials in environment variables, never in source code.
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.
4

Reuse Configuration

Create a single Configuration instance and reuse it across multiple API clients.
5

Handle Async Operations

Use async/await for clean, readable code.

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