Skip to main content

Create fixed rate transaction

After a successful call of createFixTransaction method, you get a unique ID to track the transaction status and a payin address for user to send money to.

info

The amountExpectedTo parameter value should be understood as a payout amount to the user before withholding the networkFee. To calculate the exact payout amount, deduct the networkFee value from amountExpectedTo

HTTP request

post
/v2/#createFixTransaction

Request

Header parameters

Requires authentification.

Body parameters

Requires JSON-RPC 2.0 protocol request body.

warning

Although amountFrom and amountTo are optional parameters, it is required to set one of them. If you provide none or both, the request will result in error.

The params parameter schema:

NameTypeRequiredDescription
fromstringtruePayin currency ticker (in lowercase).
tostringtruePayout currency ticker (in lowercase).
rateIdstringtrueRate ID that you get from getFixRate/getFixRateForAmount requests.
addressstringtrueRecipient address.
amountFromstringfalseAmount of currency that user is going to send.
amountTostringfalseAmount user wants to receive.
extraIdstringfalseAdditional ID for address for currencies that use additional ID for transaction processing.
refundAddressstringtrueAddress of the wallet to refund in case of any technical issues during the exchange. The currency of the wallet must match with the from currency.
refundExtraIdstringfalseextraId for refundAddress.
fromAddressstringfalseAddress of the wallet from which the user will send payin.
fromExtraIdstringfalseextraId for fromAddress.
userMetadatastringfalseEscaped JSON.
You can use userMetadata to include any additional parameters for customization purposes.
To use this feature, please contact us at [email protected].
Sample request payload
application/json
{
"jsonrpc": "2.0",
"id": "test",
"method": "createFixTransaction",
"params": {
"from": "eth",
"to": "xrp",
"address": "rwpMvf*************PQqWDwQyHUW",
"extraId": "209****48",
"amountFrom": "0.2",
"rateId": "f3dd48106a63b*********b7ab5413d32c7b96301a7e83",
"refundAddress": "0x576ea9d3**********3d3fd5f1499a0"
}
}
Sample request payload with the userMetadata
application/json
{
"jsonrpc": "2.0",
"id": "test",
"method": "createFixTransaction",
"params": {
"from": "eth",
"to": "xrp",
"address": "rwpMvf*************PQqWDwQyHUW",
"extraId": "209****48",
"amountFrom": "0.2",
"rateId": "f3dd48106a63b*********b7ab5413d32c7b96301a7e83",
"refundAddress": "0x576ea9d3**********3d3fd5f1499a0",
"userMetadata": "{\"param1\": 50, \"param2\": \"string\", \"param3\": \"50.5189\"}"
}
}
Sample cURL
curl --location --request POST 'https://api.changelly.com/v2' \
--header 'X-Api-Key: {{apiKey}}' \
--header 'X-Api-Signature: {{sign}}' \
--data-raw '{
"id": "test",
"jsonrpc": "2.0",
"method": "createFixTransaction",
"params": {
"from": "btc",
"to": "eth",
"address": "0xee*******5E3DFc214",
"amountFrom": "1",
"rateId": "f3dd48106a63b*********b7ab5413d32c7b96301a7e82",
"refundAddress": "1Bvjij5653y9****BGPuQBPzTZpb"
}
}'

Response

Response parameters

Requires JSON-RPC 2.0 protocol response body.

The result parameter schema:

NameTypeDescription
idstringTransaction ID. Could be used in getStatus method.
typestringType of transaction. Always fixed in this method.
payinAddressstringAddress for a user to send coins to.
payinExtraIdstringExtra ID for payinAddress in case it is required.
Note: If the payinExtraId parameter is returned in the response and is not null, it is required for user to send the funds to the payinAddress specifying extraId. Otherwise, the transactions will not be processed and the user will need to get a refund through technical support.
payoutAddressstringAddress where the exchange result will be sent to.
payoutExtraIdstringExtra ID for payoutAddress in case it is required.
refundAddressstringAddress of the wallet to refund in case of any technical issues during the exchange. The currency of the wallet must match with the from currency.
refundExtraIdstringExtra ID for refundAddress.
amountExpectedFromnumberThe amountFrom value from createFixTransaction request.
amountExpectedTostringThe amountTo value from getFixRateForAmount response.
This is the estimated payout amount of currency before withholding the network fee.
statusstringTransaction status. Will always be new when transaction is created. If you reference the same transaction using the getStatus or getTransactions method, you'll get the waiting status as an equivalent to new.
payTillstringIndicates time until which user needs to make the payment.
currencyTostringPayout currency ticker.
currencyFromstringPayin currency ticker.
createdAtintegerTime in timestamp format (microseconds) when the transaction was created.
networkFeestringCommission taken by the network from the amount sent to the user. Displayed in payout currency.
warning

The result scheme parameter trackUrl is deprecated. You can retrieve the actual status and transaction data from the getStatus and getTransactions methods.

Sample response
application/json
{
"jsonrpc": "2.0",
"id": "test",
"result": {
"id": "149a****m90",
"type": "fixed",
"status": "new",
"payTill": "2022-10-31T16:41:55.000000271+00:00",
"currencyFrom": "btc",
"currencyTo": "eth",
"payinExtraId": null,
"payoutExtraId": null,
"refundAddress": "1Bvjij5653y9r********QBPzTZpb",
"amountExpectedFrom": "1.00000000",
"amountExpectedTo": "32.277489930000000000",
"payinAddress": "3EkyEjzs********vZ95AyTM",
"payoutAddress": "0xeee031413*******B8Cf5E3DFc214",
"createdAt": 1664894262000000,
"networkFee": "0.000515"
}
}

Error response

Error response parameters

Check the error response schema.

Error codes

CodeMessageDescription
-32600Invalid amount: maximal amount is {max_amount}The attempt to exchange more currency than a maximal amount.
-32602Invalid currency: {currency} temporary disabledThis currency is currently disabled.
-32602Invalid currency: {currency} temporary disabled for fix rate transactionsThis currency is currently disabled for fix-rate transactions.
-32602Invalid currency: {currency} is temporary disabled on API as output currencyThis currency is currently disabled on API as an output currency.
-32602Invalid currency: {currency} is temporary disabled on API as input currencyThis currency is currently disabled on API as an input currency.
-32602Invalid currency: {currency} not foundThis currency is not listed on Changelly or the ticker is invalid.
-32602Parameter {param} is invalidYou've specified an invalid parameter.
-32602Error: Invalid addressYou've specified an invalid payout address.
-32602Error: Invalid refund addressYou've specified an invalid refund address.
-32602Error: rateId was expired or already used. Use method getFixRateForAmount to generate new rateIdNew rateId has to be generated.
-32603Internal Error or ErrorMost likely, the problem is on our side. Further investigation is required.