Skip to main content

Overview

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

PSR-7 Compatible

Uses Guzzle HTTP client for reliable API communication

Composer Support

Easy installation via Composer package manager

Comprehensive

Access to all Devdraft API endpoints and features

Modern PHP

Built for PHP 8.1+ with type hints and modern features

Installation

Using Composer

Or add to your composer.json:
Then run:

Requirements

  • PHP 8.1 or higher
  • Composer
  • Guzzle HTTP client (automatically installed)

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: void

healthControllerPublicHealthCheckV0()

Public health check endpoint (no authentication required).
Returns: \Devdraft\Model\PublicHealthResponseDto

App Balances

Query your application’s stablecoin balances.

Methods

balanceControllerGetAllBalances()

Get all stablecoin balances for your application.
Returns: \Devdraft\Model\AllBalancesResponse

balanceControllerGetUSDCBalance()

Get USDC balance only.
Returns: \Devdraft\Model\AggregatedBalanceResponse

balanceControllerGetEURCBalance()

Get EURC balance only.
Returns: \Devdraft\Model\AggregatedBalanceResponse

Customers

Manage customer records and KYC information.

Methods

customerControllerCreate($create_customer_dto)

Create a new customer.
Parameters:
  • $create_customer_dto: \Devdraft\Model\CreateCustomerDto - Customer details
Returns: \Devdraft\Model\Customer

customerControllerFindAll($page, $limit, $status)

Get all customers with optional filters.
Parameters:
  • $page: int - Page number (optional, default: 1)
  • $limit: int - Items per page (optional, default: 20)
  • $status: string - Filter by status (optional)
Returns: \Devdraft\Model\Customer[]

customerControllerFindOne($id)

Get a customer by ID.
Parameters:
  • $id: string - Customer ID
Returns: \Devdraft\Model\Customer

customerControllerUpdate($id, $update_customer_dto)

Update a customer’s information.
Parameters:
  • $id: string - Customer ID
  • $update_customer_dto: \Devdraft\Model\UpdateCustomerDto - Fields to update
Returns: \Devdraft\Model\Customer

Exchange Rates

Get real-time currency exchange rates.

Methods

exchangeRateControllerGetExchangeRate($from, $to)

Get exchange rate between any two supported currencies.
Parameters:
  • $from: string - Source currency code
  • $to: string - Target currency code
Returns: \Devdraft\Model\ExchangeRateResponseDto

exchangeRateControllerGetUSDToEURRate()

Get USD to EUR exchange rate.
Returns: \Devdraft\Model\ExchangeRateResponseDto

exchangeRateControllerGetEURToUSDRate()

Get EUR to USD exchange rate.
Returns: \Devdraft\Model\ExchangeRateResponseDto

Invoices

Create and manage invoices for your customers.

Methods

invoiceControllerCreate($create_invoice_dto)

Create a new invoice.
Parameters:
  • $create_invoice_dto: \Devdraft\Model\CreateInvoiceDto - Invoice details
Returns: \Devdraft\Model\Invoice

invoiceControllerFindAll($page, $limit, $status)

Get all invoices.
Parameters:
  • $page: int - Page number (optional)
  • $limit: int - Items per page (optional)
  • $status: string - Filter by status (optional)
Returns: \Devdraft\Model\Invoice[]

invoiceControllerFindOne($id)

Get an invoice by ID.
Parameters:
  • $id: string - Invoice ID
Returns: \Devdraft\Model\Invoice

invoiceControllerUpdate($id, $update_invoice_dto)

Update an invoice.
Parameters:
  • $id: string - Invoice ID
  • $update_invoice_dto: array - Fields to update
Returns: \Devdraft\Model\Invoice

Liquidation Addresses

Manage cryptocurrency liquidation addresses for customers.

Methods

liquidationAddressControllerCreateLiquidationAddress($customer_id, $create_liquidation_address_dto)

Create a new liquidation address for a customer.
Parameters:
  • $customer_id: string - Customer ID
  • $create_liquidation_address_dto: \Devdraft\Model\CreateLiquidationAddressDto - Address details
Returns: \Devdraft\Model\LiquidationAddressResponseDto

liquidationAddressControllerGetLiquidationAddresses($customer_id)

Get all liquidation addresses for a customer.
Parameters:
  • $customer_id: string - Customer ID
Returns: \Devdraft\Model\LiquidationAddressResponseDto[]

liquidationAddressControllerGetLiquidationAddress($customer_id, $liquidation_address_id)

Get a specific liquidation address.
Parameters:
  • $customer_id: string - Customer ID
  • $liquidation_address_id: string - Address ID
Returns: \Devdraft\Model\LiquidationAddressResponseDto

Payment Intents

Create payment intents for bank and stablecoin payments.

Methods

paymentIntentControllerCreateBankPaymentIntent($create_bank_payment_intent_dto)

Create a bank payment intent.
Parameters:
  • $create_bank_payment_intent_dto: \Devdraft\Model\CreateBankPaymentIntentDto - Intent details
Returns: \Devdraft\Model\PaymentIntent

paymentIntentControllerCreateStablePaymentIntent($create_stable_payment_intent_dto)

Create a stablecoin payment intent.
Parameters:
  • $create_stable_payment_intent_dto: \Devdraft\Model\CreateStablePaymentIntentDto - Intent details
Returns: \Devdraft\Model\PaymentIntent
Generate and manage payment links for easy customer payments.

Methods

Create a new payment link.
Parameters:
  • $create_payment_link_dto: \Devdraft\Model\CreatePaymentLinkDto - Link details
Returns: \Devdraft\Model\PaymentLink

paymentLinksControllerFindAll($page, $limit, $active)

Get all payment links.
Parameters:
  • $page: int - Page number (optional)
  • $limit: int - Items per page (optional)
  • $active: bool - Filter by active status (optional)
Returns: \Devdraft\Model\PaymentLink[]

paymentLinksControllerFindOne($id)

Get a payment link by ID.
Parameters:
  • $id: string - Payment link ID
Returns: \Devdraft\Model\PaymentLink Update a payment link.
Parameters:
  • $id: string - Payment link ID
  • $update_payment_link_dto: array - Fields to update
Returns: \Devdraft\Model\PaymentLink

Products

Manage your product catalog.

Methods

productControllerCreate($create_product_dto)

Create a new product.
Parameters:
  • $create_product_dto: array - Product details
Returns: \Devdraft\Model\Product

productControllerFindAll($category, $active)

Get all products.
Parameters:
  • $category: string - Filter by category (optional)
  • $active: bool - Filter by active status (optional)
Returns: \Devdraft\Model\Product[]

productControllerFindOne($id)

Get a product by ID.
Parameters:
  • $id: string - Product ID
Returns: \Devdraft\Model\Product

productControllerUpdate($id, $update_product_dto)

Update a product.
Parameters:
  • $id: string - Product ID
  • $update_product_dto: array - Fields to update
Returns: \Devdraft\Model\Product

productControllerRemove($id)

Delete a product.
Parameters:
  • $id: string - Product ID
Returns: void

productControllerUploadImage($id, $images)

Upload images for a product.
Parameters:
  • $id: string - Product ID
  • $images: \SplFileObject[] - Image files
Returns: \Devdraft\Model\Product

Taxes

Configure and manage tax settings.

Methods

taxControllerCreate($create_tax_dto)

Create a new tax configuration.
Parameters:
  • $create_tax_dto: \Devdraft\Model\CreateTaxDto - Tax details
Returns: \Devdraft\Model\Tax

taxControllerFindAll($country)

Get all tax configurations.
Parameters:
  • $country: string - Filter by country (optional)
Returns: \Devdraft\Model\Tax[]

taxControllerFindOne($id)

Get a tax configuration by ID.
Parameters:
  • $id: string - Tax ID
Returns: \Devdraft\Model\Tax

taxControllerUpdate($id, $update_tax_dto)

Update a tax configuration.
Parameters:
  • $id: string - Tax ID
  • $update_tax_dto: \Devdraft\Model\UpdateTaxDto - Fields to update
Returns: \Devdraft\Model\Tax

taxControllerRemove($id)

Delete a tax configuration.
Parameters:
  • $id: string - Tax ID
Returns: void

Test Payments

Process test payments in sandbox environment.

Methods

testPaymentControllerCreatePaymentV0($payment_request_dto)

Create a test payment.
Parameters:
  • $payment_request_dto: \Devdraft\Model\PaymentRequestDto - Payment details
Returns: \Devdraft\Model\PaymentResponseDto

testPaymentControllerGetPaymentV0($id)

Get test payment details by ID.
Parameters:
  • $id: string - Payment ID
Returns: \Devdraft\Model\PaymentResponseDto

testPaymentControllerRefundPaymentV0($id, $refund_amount)

Refund a test payment.
Parameters:
  • $id: string - Payment ID
  • $refund_amount: float - Amount to refund (optional, defaults to full amount)
Returns: \Devdraft\Model\RefundResponseDto

Transfers

Initiate and manage fund transfers between different payment rails.

Methods

transferControllerCreateDirectBankTransfer($create_direct_bank_transfer_dto)

Create a direct bank transfer.
Parameters:
  • $create_direct_bank_transfer_dto: \Devdraft\Model\CreateDirectBankTransferDto - Transfer details
Returns: \Devdraft\Model\Transfer See also: Direct Bank Transfer Guide

transferControllerCreateDirectWalletTransfer($create_direct_wallet_transfer_dto)

Create a direct wallet transfer.
Parameters:
  • $create_direct_wallet_transfer_dto: \Devdraft\Model\CreateDirectWalletTransferDto - Transfer details
Returns: \Devdraft\Model\Transfer See also: Direct Wallet Transfer Guide

transferControllerCreateExternalBankTransfer($create_external_bank_transfer_dto)

Create an external bank transfer (from your wallet to external bank).
Parameters:
  • $create_external_bank_transfer_dto: \Devdraft\Model\CreateExternalBankTransferDto - Transfer details
Returns: \Devdraft\Model\Transfer

transferControllerCreateExternalStablecoinTransfer($create_external_stablecoin_transfer_dto)

Create an external stablecoin transfer (from your wallet to external wallet).
Parameters:
  • $create_external_stablecoin_transfer_dto: \Devdraft\Model\CreateExternalStablecoinTransferDto - Transfer details
Returns: \Devdraft\Model\Transfer

transferControllerCreateStablecoinConversion($create_stablecoin_conversion_dto)

Convert between different stablecoins or networks.
Parameters:
  • $create_stablecoin_conversion_dto: \Devdraft\Model\CreateStablecoinConversionDto - Conversion details
Returns: \Devdraft\Model\Conversion See also: Stablecoin Conversion Guide

Wallets

Manage wallets and query balances.

Methods

walletControllerGetWallets()

Get all wallets for your application.
Returns: 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($create_webhook_dto)

Create a new webhook.
Parameters:
  • $create_webhook_dto: \Devdraft\Model\CreateWebhookDto - Webhook configuration
Returns: \Devdraft\Model\WebhookResponseDto See also: Webhooks Overview

webhookControllerFindAll($page, $limit, $active)

Get all webhooks.
Parameters:
  • $page: int - Page number (optional)
  • $limit: int - Items per page (optional)
  • $active: bool - Filter by active status (optional)
Returns: \Devdraft\Model\WebhookResponseDto[]

webhookControllerFindOne($id)

Get a webhook by ID.
Parameters:
  • $id: string - Webhook ID
Returns: \Devdraft\Model\WebhookResponseDto

webhookControllerUpdate($id, $update_webhook_dto)

Update a webhook.
Parameters:
  • $id: string - Webhook ID
  • $update_webhook_dto: \Devdraft\Model\UpdateWebhookDto - Fields to update
Returns: \Devdraft\Model\WebhookResponseDto

webhookControllerRemove($id)

Delete a webhook.
Parameters:
  • $id: string - Webhook ID
Returns: void

Error Handling

All SDK methods throw exceptions on errors. Handle them appropriately:

Best Practices

1

Use Environment Variables for Credentials

Store API credentials in environment variables, never in source code.
2

Reuse Configuration and Client Instances

Create a single configuration and reuse it across your application.
3

Proper Exception Handling

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

Use Type Hints

Leverage PHP’s type hints for better code quality and IDE support.
5

Validate Input Data

Validate input data before making API calls to catch errors early.
6

Implement Logging

Use PSR-3 compatible logging for debugging and monitoring.

Testing with PHPUnit

Example PHPUnit test for SDK integration:

Laravel Integration

Example Laravel service provider for Devdraft SDK:
Usage in Laravel controller:

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