Skip to main content

Create transaction

POST createTransaction

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

The method creates a pair of deposit and payout addresses. If somebody sends coins to the same address twice, without the second call to createTransaction, the coins are exchanged and sent to the user's payout address.

note

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

HTTP request

https://api.changelly.com/v2/#createTransaction

Request

Header parameters
NameTypeRequiredDescription
X-Api-KeystringtrueYour API key (SHA256 from Public Key)
X-Api-SignaturestringtrueThe query's serialized body signed by your private key according to the RSA-SHA256 method.

Body parameters

NameTypeRequiredDescription
jsonrpcstringtrueJSON-RPC version.
idstringtrueClient's custom ID.
methodstringtrueAPI method name.
paramsobjecttrueRequest parameters.

params object:

NameTypeRequiredDescription
fromstringtruePayin currency code (in lowercase).
tostringtruePayout currency code (in lowercase).
amountFromstringtrueAmount of currency that user is going to send.
addressstringtrueRecipient address.
extraIdstringfalseAdditional ID for address for currencies that use additional ID for transaction processing.
refundAddressstringfalseAddress 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.
subaccountIdstringfalsesubaccountId from createSubaccount.
userMetadatastringfalseEscaped JSON.
You can use userMetadata to include any additional parameters for customization purposes.
To use this feature, please contact us at [email protected].

Response

Sample response

Example 1
application/json
{
"jsonrpc": "2.0",
"id": "test",
"result": {
"id": "uzul********97b",
"type": "float",
"payinExtraId": null,
"payoutExtraId": "20*****48",
"amountExpectedFrom": "0.0339",
"status": "new",
"currencyFrom": "eth",
"currencyTo": "xrp",
"amountExpectedTo": "94.525000",
"payinAddress": "0x375132b5**********1b36691a72",
"payoutAddress": "rwpMvfxoo**********WDwQyHUW",
"createdAt": 1667222297000000,
"networkFee": "0.22155"
}
}
Example 2
application/json
{
"jsonrpc": "2.0",
"id": "test",
"result": {
"id": "uiib******khs9n",
"type": "float",
"payinExtraId": "88198*****2666",
"payoutExtraId": "20*****48",
"refundAddress": "GAV6LA3M3****************QWQ5LGO365",
"refundExtraId": "6459********435",
"amountExpectedFrom": "400",
"status": "new",
"currencyFrom": "xlm",
"currencyTo": "xrp",
"amountExpectedTo": "100.495000",
"payinAddress": "GAV6LA3M3OP***********************4HQWQ5LGO365",
"payoutAddress": "rwpMvfx***************wQyHUW",
"createdAt": 1667222296000000,
"networkFee": "0.22155"
}
}