This guide provides a comprehensive walkthrough of integrating with the Two-Coin platform. Follow these steps to successfully implement cryptocurrency payment functionality in your application.
Two-Coin uses integer IDs to uniquely identify currencies. This system has several advantages:
USD (US Dollar) = 35
EUR (Euro) = 6
GBP (British Pound) = 49
BTC (Bitcoin) = 15
ETH (Ethereum) = 22
USDC (USD Coin) = 2⚠️ Required: Always start here. This data is essential for all subsequent API calls.
Fetch all currencies and cache the mapping:
GET https://api.dev2coin.space/api/dict/currenciesBuild two lookup tables:
id_to_currency - Maps integer ID to currency info (35 → USD)ticker_to_id - Maps ticker to ID ("USD" → 35)GET https://api.dev2coin.space/api/on_ramp/countriesUse this to show your user a list of supported countries for selection.
After user selects a country, fetch available currency pairs:
GET https://api.dev2coin.space/api/on_ramp/currency_pairs?country_code=USResponse example:
[
{
"provider_code": "changelly",
"fiat_currencies": [35, 6, 49],
"crypto_currencies": [15, 22, 2]
},
{
"provider_code": "kado",
"fiat_currencies": [35],
"crypto_currencies": [15, 22]
}
]How to interpret: Use your currency lookup to resolve IDs. Display fiat currencies (USD, EUR, GBP) separately from cryptocurrencies (BTC, ETH, USDC) to the user.
After user selects a fiat currency, get available payment methods:
GET https://api.dev2coin.space/api/on_ramp/payment_methods?fiat_currency=35&country_code=USDisplay available payment methods (credit card, bank transfer, etc.) to the user.
After user enters amount and selects payment method, fetch offers:
GET https://api.dev2coin.space/api/on_ramp/offers?external_user_id=user123¤cy_from=35¤cy_to=15&amount_from=100.00&country=US&payment_method=cardResponse is an object with provider codes as keys:
{
"changelly": {
"rate": "0.000025",
"inverted_rate": "40000.00",
"fee": "4.99",
"amount_from": "100.00",
"amount_expected_to": "0.002375"
},
"kado": {
"rate": "0.0000251",
"inverted_rate": "39841.27",
"fee": "3.99",
"amount_from": "100.00",
"amount_expected_to": "0.002410"
}
}Display offers to the user with:
amount_expected_to)fee)inverted_rate for display)Before creating an order, validate the user's wallet address:
POST https://api.dev2coin.space/api/on_ramp/validate-address
{
"provider_code": "changelly",
"currency": 15,
"wallet_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
}Response:
{"result": true}After user selects a provider and wallet is validated:
POST https://api.dev2coin.space/api/on_ramp/orders
{
"provider_code": "changelly",
"from_currency": 35,
"from_amount": "100.00",
"to_currency": 15,
"wallet_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
"payment_method": "card",
"country_code": "US",
"state_code": "CA",
"external_user_id": "user_12345",
"external_order_id": "order_67890"
}Critical Requirements:
external_user_id is REQUIREDexternal_order_id is REQUIREDstate_code is REQUIRED if country has states (check GET /api/dict/countries)id and your external_order_idResponse includes a redirect_url - redirect your user here to complete payment with the provider.
Orders update through webhooks. Implement webhook verification and listen for status changes (pending → processing → complete).
See the Webhooks section for implementation details.
❌ Using Currency Tickers Instead of IDs
Wrong:
{"from_currency": "USD", "to_currency": "BTC"}Correct:
{"from_currency": 35, "to_currency": 15}❌ Using Wrong Endpoint for Offers
Wrong:
POST /api/on_ramp/offersCorrect:
GET /api/on_ramp/offers?currency_from=35&...❌ Omitting Required Fields
Missing external_user_id or external_order_id when creating orders will cause failures.
❌ Not Caching Currency Dictionary
Fetching on every request causes unnecessary latency. Cache for 24 hours and rebuild lookup tables once at startup.
external_order_id and provider's order_codeQuestions? See the API Reference for all endpoints or check the individual documentation pages for each service.
If you encounter any issues or have questions not addressed in this documentation, please contact our support team on Telegram at https://t.me/cs_2coin (@cs_2coin).