Create a float-rate transaction
posthttps://api.criptointercambio.com/v2/#createTransactionRetrieves a created transaction with a float rate and a unique ID. With this ID, you can track the transaction status and a payin address for user to send money to.
Additionally, the method retrieves a pair of deposit and payout addresses. If the user sends coins to the same address twice, without the second call to createTransaction, Exchange API exchanges and sends them to the user's payout address.
The amountExpectedTo value is a payout amount before withholding networkFee. To calculate the exact payout amount, deduct the networkFee value from amountExpectedTo.
Request
Header parameters
Requires authentication headers.
Body parameters
Consists of a JSON-RPC 2.0 protocol request object.
The params schema:
| Name | Type | Required | Description |
|---|---|---|---|
address | string | true | The payout address. |
amountFrom | string | true | The amount for sending. |
extraId | string | false | The address additional ID. |
from | string | true | The payin currency ticker. Enter in lowercase. |
to | string | true | The payout currency ticker. Enter in lowercase. |
refundAddress | string | false | The wallet address for the refund. Required for technical issues during the exchange. The wallet currency must match the from one. |
refundExtraId | string | false | The additional ID for refundAddress. |
userMetadata | string | false | The escaped JSON. Info The userMetadata param can include any additional settings for customization. To use this feature, contact us at [email protected]. |
Sample request
{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"method": "createTransaction",
"params": {
"address": "cosmos***********8hz",
"extraId": "894*********6261",
"amountFrom": "56",
"from": "xrp",
"to": "atom",
"userMetadata": "{\"param1\": 50, \"param2\": \"string\", \"param3\": \"50.5189\"}"
}
}
Response
Successful response
Consists of a JSON-RPC 2.0 protocol response object.
The result schema:
| Name | Type | Description |
|---|---|---|
amountExpectedFrom | number | The amountFrom value from the createTransaction request. |
amountExpectedTo | string | The amountTo value from the getExchangeAmount response at the moment of createTransaction calling. This is the estimated payout amount before withholding the networkFee. |
createdAt | timestamp | The transaction creation time. |
currencyTo | string | The payout currency ticker. |
currencyFrom | string | The payin currency ticker. |
id | string | The transaction ID. Can be used in getStatus. |
networkFee | string | The network fee from a sent amount. Displayed in the payout currency. |
payinAddress | string | The wallet address for sending coins. |
payinExtraId | string | The payinAddress extra ID. Info If the payinExtraId param returns as not null, the user should send the funds to the payinAddress with the extraId. Otherwise, the user has to get a refund through technical support. |
payoutAddress | string | The wallet address for sending the exchange result. |
payoutExtraId | string | The payoutAddress extra ID. |
refundAddress | string | The wallet address for the refund. Required for technical issues during the exchange. The wallet currency must match the from one. |
refundExtraId | string | The refundAddress extra ID. |
status | string | The transaction status. Always new at the createdAt time. InfoIf you reference the same transaction using the getStatus or getTransactions method, you get the waiting status as an equivalent to new. |
type | string | The transaction type. Always float in the createTransaction response. |
The trackUrl param is deprecated. Retrieve the actual status and transaction data from the getStatus and getTransactions methods.
Sample successful response
{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"result": {
"amountExpectedFrom": "0",
"amountExpectedTo": "0",
"createdAt": 1709126365000000,
"currencyFrom": "xrp",
"currencyTo": "atom",
"id": "hd16********83b4",
"networkFee": "0.004424",
"payinAddress": "rhL5*************uJaY1T",
"payinExtraId": "36*****747",
"payoutAddress": "cosmos***********8hz",
"payoutExtraId": "894*********6261",
"status": "new",
"type": "float"
}
}
Error response
Consists of a JSON-RPC 2.0 protocol error response object.
Sample error response
{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"error": {
"code": -32600,
"message": "Error: You reached requests limit 10 rps"
}
}
Error codes
| Code | Message | Description |
|---|---|---|
-32600 | Invalid amount: maximal amount is {max_amount} | The currency amount for exchange is above the maximum amount. |
Invalid amount: minimal amount is {min_amount} | The currency amount for exchange is below the minimum amount. | |
Error: You reached requests limit {limit} rps | RPS is out of the limit. | |
-32602 | Invalid currency: {currency} temporary disabled | Cripto InterCambio temporarily disabled this currency. |
Invalid currency: {currency} is temporary disabled on API as input currency | Cripto InterCambio temporarily disabled this currency for payin. | |
Invalid currency: {currency} is temporary disabled on API as output currency | Cripto InterCambio temporarily disabled this currency for payout. | |
Invalid currency: {currency} not found |
| |
Parameter {param} is invalid | The specified request param is invalid. | |
Error: Invalid address | The specified payout address is invalid. | |
Not enough liquidity in pair {from_currency}->{to_currency}. Max amount is {max_from} {from_currency}. | The specified amount is above a maximum volume. | |
-32603 |
| Mostly, this is a technical issue on our side. Requires further investigation. |
An error encountered during address generation. Please try again later | An address generation error. |