This page describes how to work with offers in the Two-Coin payment system. Offers represent quotes from different cryptocurrency providers that can be used to create orders.
An offer is a quote from a provider that includes:
To get a list of available offers, make a GET request to the offers endpoint with the following parameters:
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&state=CAImportant: Currency parameters use integer IDs (35=USD, 15=BTC), not ticker symbols. Get IDs from GET /api/dict/currencies
| Parameter | Type | Required | Description |
|---|---|---|---|
currency_from | integer | Yes | Source currency ID (e.g., 35 for USD) |
currency_to | integer | Yes | Target currency ID (e.g., 15 for BTC) |
amount_from | string | Yes | Amount to exchange |
country | string | Yes | Country code (ISO 3166-1 alpha-2) |
external_user_id | string | Yes | Your internal user identifier |
state | string | Conditional* | Required if the country has states in GET /api/dict/countries |
ip | string | No | User's IP address |
payment_method | string | No | Filter by payment method code (e.g., card) |
provider_codes | string | No | Comma-separated provider codes to filter |
Response 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",
"payment_methods": [
{ "payment_method_code": "card", "fee": "3.5%" }
]
},
"kado": {
"rate": "0.0000251",
"inverted_rate": "39841.27",
"fee": "3.99",
"amount_from": "100.00",
"amount_expected_to": "0.002410"
}
}Each offer object contains the following fields:
| Field | Type | Description |
|---|---|---|
rate | string | Exchange rate (crypto per fiat unit) |
inverted_rate | string | Inverted exchange rate (fiat per crypto unit) |
fee | string | Total fee amount in source currency |
amount_from | string | Amount in fiat currency to pay |
amount_expected_to | string | Expected cryptocurrency amount to receive |
payment_methods | array (optional) | Payment method fee breakdown: [{payment_method_code, fee}] |
Offers are valid for a limited time, typically 2 minutes. The expires_at field indicates when the offer will expire. After this time, the offer cannot be used to create an order, and you'll need to request new offers.
Due to cryptocurrency price volatility, offers have a short expiration time. Always check the expires_at timestamp and get new offers if the current ones have expired.
Once you have retrieved offers, you can:
amount_expected_to (highest to lowest)provider_code to create an orderPOST https://api.dev2coin.space/api/on_ramp/orders
{
"provider_code": "changelly",
"external_user_id": "user_12345",
"external_order_id": "order_67890",
"from_currency": 35,
"to_currency": 15,
"from_amount": "100.00",
"payment_method": "card",
"country_code": "US",
"wallet_address": "bc1q..."
}You can filter offers by payment method or specific providers:
GET https://api.dev2coin.space/api/on_ramp/offers?external_user_id=user123¤cy_from=35¤cy_to=15&amount_from=100&country=US&state=CA&payment_method=card&provider_codes=changelly,kadoEach offer includes a breakdown of the fees associated with the transaction:
The total_fee_amount field provides the sum of all fees in the source currency.
Here's an example of how you might display offers to the user:
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).