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
composer.json:
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.
void
healthControllerPublicHealthCheckV0()
Public health check endpoint (no authentication required).
\Devdraft\Model\PublicHealthResponseDto
App Balances
Query your application’s stablecoin balances.Methods
balanceControllerGetAllBalances()
Get all stablecoin balances for your application.
\Devdraft\Model\AllBalancesResponse
balanceControllerGetUSDCBalance()
Get USDC balance only.
\Devdraft\Model\AggregatedBalanceResponse
balanceControllerGetEURCBalance()
Get EURC balance only.
\Devdraft\Model\AggregatedBalanceResponse
Customers
Manage customer records and KYC information.Methods
customerControllerCreate($create_customer_dto)
Create a new customer.
$create_customer_dto: \Devdraft\Model\CreateCustomerDto- Customer details
\Devdraft\Model\Customer
customerControllerFindAll($page, $limit, $status)
Get all customers with optional filters.
$page: int- Page number (optional, default: 1)$limit: int- Items per page (optional, default: 20)$status: string- Filter by status (optional)
\Devdraft\Model\Customer[]
customerControllerFindOne($id)
Get a customer by ID.
$id: string- Customer ID
\Devdraft\Model\Customer
customerControllerUpdate($id, $update_customer_dto)
Update a customer’s information.
$id: string- Customer ID$update_customer_dto: \Devdraft\Model\UpdateCustomerDto- Fields to update
\Devdraft\Model\Customer
Exchange Rates
Get real-time currency exchange rates.Methods
exchangeRateControllerGetExchangeRate($from, $to)
Get exchange rate between any two supported currencies.
$from: string- Source currency code$to: string- Target currency code
\Devdraft\Model\ExchangeRateResponseDto
exchangeRateControllerGetUSDToEURRate()
Get USD to EUR exchange rate.
\Devdraft\Model\ExchangeRateResponseDto
exchangeRateControllerGetEURToUSDRate()
Get EUR to USD exchange rate.
\Devdraft\Model\ExchangeRateResponseDto
Invoices
Create and manage invoices for your customers.Methods
invoiceControllerCreate($create_invoice_dto)
Create a new invoice.
$create_invoice_dto: \Devdraft\Model\CreateInvoiceDto- Invoice details
\Devdraft\Model\Invoice
invoiceControllerFindAll($page, $limit, $status)
Get all invoices.
$page: int- Page number (optional)$limit: int- Items per page (optional)$status: string- Filter by status (optional)
\Devdraft\Model\Invoice[]
invoiceControllerFindOne($id)
Get an invoice by ID.
$id: string- Invoice ID
\Devdraft\Model\Invoice
invoiceControllerUpdate($id, $update_invoice_dto)
Update an invoice.
$id: string- Invoice ID$update_invoice_dto: array- Fields to update
\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.
$customer_id: string- Customer ID$create_liquidation_address_dto: \Devdraft\Model\CreateLiquidationAddressDto- Address details
\Devdraft\Model\LiquidationAddressResponseDto
liquidationAddressControllerGetLiquidationAddresses($customer_id)
Get all liquidation addresses for a customer.
$customer_id: string- Customer ID
\Devdraft\Model\LiquidationAddressResponseDto[]
liquidationAddressControllerGetLiquidationAddress($customer_id, $liquidation_address_id)
Get a specific liquidation address.
$customer_id: string- Customer ID$liquidation_address_id: string- Address ID
\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.
$create_bank_payment_intent_dto: \Devdraft\Model\CreateBankPaymentIntentDto- Intent details
\Devdraft\Model\PaymentIntent
paymentIntentControllerCreateStablePaymentIntent($create_stable_payment_intent_dto)
Create a stablecoin payment intent.
$create_stable_payment_intent_dto: \Devdraft\Model\CreateStablePaymentIntentDto- Intent details
\Devdraft\Model\PaymentIntent
Payment Links
Generate and manage payment links for easy customer payments.Methods
paymentLinksControllerCreate($create_payment_link_dto)
Create a new payment link.
$create_payment_link_dto: \Devdraft\Model\CreatePaymentLinkDto- Link details
\Devdraft\Model\PaymentLink
paymentLinksControllerFindAll($page, $limit, $active)
Get all payment links.
$page: int- Page number (optional)$limit: int- Items per page (optional)$active: bool- Filter by active status (optional)
\Devdraft\Model\PaymentLink[]
paymentLinksControllerFindOne($id)
Get a payment link by ID.
$id: string- Payment link ID
\Devdraft\Model\PaymentLink
paymentLinksControllerUpdate($id, $update_payment_link_dto)
Update a payment link.
$id: string- Payment link ID$update_payment_link_dto: array- Fields to update
\Devdraft\Model\PaymentLink
Products
Manage your product catalog.Methods
productControllerCreate($create_product_dto)
Create a new product.
$create_product_dto: array- Product details
\Devdraft\Model\Product
productControllerFindAll($category, $active)
Get all products.
$category: string- Filter by category (optional)$active: bool- Filter by active status (optional)
\Devdraft\Model\Product[]
productControllerFindOne($id)
Get a product by ID.
$id: string- Product ID
\Devdraft\Model\Product
productControllerUpdate($id, $update_product_dto)
Update a product.
$id: string- Product ID$update_product_dto: array- Fields to update
\Devdraft\Model\Product
productControllerRemove($id)
Delete a product.
$id: string- Product ID
void
productControllerUploadImage($id, $images)
Upload images for a product.
$id: string- Product ID$images: \SplFileObject[]- Image files
\Devdraft\Model\Product
Taxes
Configure and manage tax settings.Methods
taxControllerCreate($create_tax_dto)
Create a new tax configuration.
$create_tax_dto: \Devdraft\Model\CreateTaxDto- Tax details
\Devdraft\Model\Tax
taxControllerFindAll($country)
Get all tax configurations.
$country: string- Filter by country (optional)
\Devdraft\Model\Tax[]
taxControllerFindOne($id)
Get a tax configuration by ID.
$id: string- Tax ID
\Devdraft\Model\Tax
taxControllerUpdate($id, $update_tax_dto)
Update a tax configuration.
$id: string- Tax ID$update_tax_dto: \Devdraft\Model\UpdateTaxDto- Fields to update
\Devdraft\Model\Tax
taxControllerRemove($id)
Delete a tax configuration.
$id: string- Tax ID
void
Test Payments
Process test payments in sandbox environment.Methods
testPaymentControllerCreatePaymentV0($payment_request_dto)
Create a test payment.
$payment_request_dto: \Devdraft\Model\PaymentRequestDto- Payment details
\Devdraft\Model\PaymentResponseDto
testPaymentControllerGetPaymentV0($id)
Get test payment details by ID.
$id: string- Payment ID
\Devdraft\Model\PaymentResponseDto
testPaymentControllerRefundPaymentV0($id, $refund_amount)
Refund a test payment.
$id: string- Payment ID$refund_amount: float- Amount to refund (optional, defaults to full amount)
\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.
$create_direct_bank_transfer_dto: \Devdraft\Model\CreateDirectBankTransferDto- Transfer details
\Devdraft\Model\Transfer
See also: Direct Bank Transfer Guide
transferControllerCreateDirectWalletTransfer($create_direct_wallet_transfer_dto)
Create a direct wallet transfer.
$create_direct_wallet_transfer_dto: \Devdraft\Model\CreateDirectWalletTransferDto- Transfer details
\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).
$create_external_bank_transfer_dto: \Devdraft\Model\CreateExternalBankTransferDto- Transfer details
\Devdraft\Model\Transfer
transferControllerCreateExternalStablecoinTransfer($create_external_stablecoin_transfer_dto)
Create an external stablecoin transfer (from your wallet to external wallet).
$create_external_stablecoin_transfer_dto: \Devdraft\Model\CreateExternalStablecoinTransferDto- Transfer details
\Devdraft\Model\Transfer
transferControllerCreateStablecoinConversion($create_stablecoin_conversion_dto)
Convert between different stablecoins or networks.
$create_stablecoin_conversion_dto: \Devdraft\Model\CreateStablecoinConversionDto- Conversion details
\Devdraft\Model\Conversion
See also: Stablecoin Conversion Guide
Wallets
Manage wallets and query balances.Methods
walletControllerGetWallets()
Get all wallets for your application.
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.
$create_webhook_dto: \Devdraft\Model\CreateWebhookDto- Webhook configuration
\Devdraft\Model\WebhookResponseDto
See also: Webhooks Overview
webhookControllerFindAll($page, $limit, $active)
Get all webhooks.
$page: int- Page number (optional)$limit: int- Items per page (optional)$active: bool- Filter by active status (optional)
\Devdraft\Model\WebhookResponseDto[]
webhookControllerFindOne($id)
Get a webhook by ID.
$id: string- Webhook ID
\Devdraft\Model\WebhookResponseDto
webhookControllerUpdate($id, $update_webhook_dto)
Update a webhook.
$id: string- Webhook ID$update_webhook_dto: \Devdraft\Model\UpdateWebhookDto- Fields to update
\Devdraft\Model\WebhookResponseDto
webhookControllerRemove($id)
Delete a webhook.
$id: string- Webhook ID
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: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
