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/offers?source_currency=USD&source_amount=100&target_currency=BTC
Parameter | Description | Required |
---|---|---|
source_currency | Currency code for source amount (e.g., USD, EUR) | Yes |
source_amount | Amount in source currency | Yes |
target_currency | Cryptocurrency code to purchase (e.g., BTC, ETH) | Yes |
payment_method_id | Filter offers by payment method | No |
{
"offers": [
{
"offer_id": "ofr_123456",
"provider_id": "provider_a",
"source_amount": 100,
"source_currency": "USD",
"target_amount": 0.003,
"target_currency": "BTC",
"rate": 33333.33,
"payment_method_id": "pm_credit_card",
"fees": {
"processing_fee": 2.5,
"network_fee": 1
},
"total_fee_amount": 3.5,
"expires_at": 1673456400
},
{
"offer_id": "ofr_123457",
"provider_id": "provider_b",
"source_amount": 100,
"source_currency": "USD",
"target_amount": 0.00298,
"target_currency": "BTC",
"rate": 33557.05,
"payment_method_id": "pm_bank_transfer",
"fees": {
"processing_fee": 1.0,
"network_fee": 1
},
"total_fee_amount": 2.0,
"expires_at": 1673456400
},
// More offers...
]
}
Property | Description |
---|---|
offer_id | Unique identifier for the offer |
provider_id | Identifier of the provider making the offer |
source_amount | Amount in fiat currency to pay |
source_currency | Code of the fiat currency |
target_amount | Amount in cryptocurrency to receive |
target_currency | Code of the cryptocurrency |
rate | Exchange rate (source_amount / target_amount) |
payment_method_id | Identifier of the payment method |
fees | Breakdown of fees |
total_fee_amount | Total amount of fees in source currency |
expires_at | Unix timestamp when the offer expires |
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 a list of offers, you can:
offer_id
to create an orderPOST https://api.dev2coin.space/orders
{
"offer_id": "ofr_123456",
"target_address": "bc1q...",
"customer_email": "[email protected]",
"redirect_url": "https://your-site.com/order-complete"
}
You can filter offers by payment method to show only offers that use a specific payment method:
GET /offers?source_currency=USD&source_amount=100&target_currency=BTC&payment_method_id=pm_credit_card
Each 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).