Overview
This guide provides a comprehensive walkthrough for implementing the Stable Sea Terminal API in production. It covers the complete order flow from authentication to settlement, including security, monitoring, error handling, and best practices.Step-by-Step Integration
Follow these steps to implement the complete order flow from organization creation to settlement:1
Authentication
All API requests require Bearer token authentication. Your API key serves as the bearer token.
Replace
YOUR_API_KEY with your actual API key. Store this securely and never expose it in client-side code.2
Create Organization
Create an organization entity to associate with your orders and payment instruments.Response:
3
Create External Payment Instruments
Set up both payin and payout payment methods for your organization.Create Payin Payment Instrument (USDC Solana Address):Create Payout Payment Instrument (COP Bank Account):USDC Solana Address Response:COP Bank Account Response:
4
Check Liquidity Providers
Get available liquidity providers with their trading pairs and operating hours.Response:
5
Get Current Exchange Rate (Optional)
Optionally fetch current exchange rates to display to end users. This is useful for showing indicative rates before creating formal quotes.Response:
Exchange rates are indicative and may change frequently. For guaranteed rates, use the quote endpoint to lock in a rate for order execution.
6
Create Offerings
Generate available payment corridors and rates for your organization.Response:
Offerings contain indicative rates and fees. Final rates are locked when creating quotes.
7
Create Quote
Get firm pricing with locked exchange rates and expiration times.Response:
8
Create Order
Convert your quote into an executable order before expiration.Response:
9
Monitor Order Status
Track your order through the complete settlement lifecycle.Order Status Progression:
STEP_1_AWAITING_FUNDING- Waiting for payin fundsSTEP_2_FILLING_FX- Executing foreign exchangeSTEP_3_SETTLING_PAYOUT- Processing payout settlementSTEP_4_COMPLETED- Order successfully completed
Poll the order status endpoint periodically to monitor order progress. Consider implementing exponential backoff between polling requests.
Production Considerations
API Key Security
- Store API keys in environment variables, not code
- Use different keys for sandbox and production
- Rotate keys regularly for security
- Use secret management services (AWS Secrets Manager, HashiCorp Vault)
- Always use HTTPS/TLS 1.3 for API communications
- Implement proper access controls and audit logging
Error Handling
Monitoring
- Track order success rates and settlement times
- Monitor API response times and error rates
- Set up alerts for high error rates or slow responses
- Log all API interactions with correlation IDs
- Use structured logging with JSON format
- Monitor quote-to-order conversion rates
- Track performance by payment method and currency pair
- Set up dashboards for real-time order flow visibility

