Skip to main content

Create order

Create a crypto purchase order with a redirect URL to the purchase page.

HTTP request​

post
/v1/orders

Request​

Header parameters​

Requires authentification.

Body parameters​

NameTypeRequiredDescription
amountFromstringtrueAmount of currency the user is going to pay.
countrystringtrueCountry ISO 3166-1 code (Alpha-2).
statestringfalseState ISO 3166-2 code. Is required if provided country is US.
currencyFromstringtrueTicker of the payin currency in uppercase.
currencyTostringtrueTicker of the payout currency in uppercase.
externalOrderIdstringtrueOrder ID provided by you.
externalUserIdstringtrueUser ID provided by you.
providerCodestringtrueThe On-Ramp provider code. Possible values.
ipstringtrueUser's IP address.
walletAddressstringtrueRecipient wallet address.
Here are 2 simple use cases of this parameter:
  • If you want to provide the cryptocurrency purchase service, you should enable the user to specify the wallet address.
  • If you want to sell your products for fiat and receive cryptocurrency in your wallet, you should specify your own wallet address.
walletExtraIdstringfalseProperty required for wallet addresses of currencies that use an additional ID for transaction processing (XRP, XLM, EOS, BNB).
metadataobjectfalseMetadata object, which can contain any parameters you need.
paymentMethodstringfalseThe payment method code. Possible values.
returnSuccessUrlstringfalseReturn URL after a successfully completed transaction.
returnFailedUrlstringfalseReturn URL after a failed transaction.
userAgentstringfalseUser Agent.

Learn more details about the returnSuccessUrl and returnFailedUrl parameters.

Sample payload
application/json
{
"externalOrderId": "test_tx",
"externalUserId": "test_user",
"providerCode": "moonpay",
"currencyFrom": "USD",
"currencyTo": "BTC",
"amountFrom": "150",
"country": "NL",
"walletAddress": "...",
"paymentMethod": "card",
"returnSuccessUrl": "https://example.com/success",
"returnFailedUrl": "https://example.com/failed",
"ip": "192.1.1.2"
}
Sample cURL
curl --location --request POST
'https://fiat-api.changelly.com/v1/orders'
--header 'X-Api-Key: {{apiKey}}'
--header 'X-Api-Signature: {{signature}}'
--data-raw '{
"externalOrderId": "test_tx",
"externalUserId": "test_user",
"providerCode": "moonpay",
"currencyFrom": "USD",
"currencyTo": "BTC",
"amountFrom": "150",
"country": "NL",
"walletAddress": "...",
"paymentMethod": "card",
"returnSuccessUrl": "https://example.com/success",
"returnFailedUrl": "https://example.com/failed",
"ip": "192.1.1.2"
}'

Response​

info

If any of the optional parameters are not provided in the request, they will be returned with the null value in the response.

Response params​

NameTypeRequiredDescription
amountFromstringtrueAmount of currency the user is going to pay.
countrystringtrueCountry ISO 3166-1 code (Alpha-2).
statestringfalseState ISO 3166-2 code. Is required if provided country is US.
createdAtdate-timetrueTime in ISO 8601 format.
currencyFromstringtrueTicker of the payin currency in uppercase.
currencyTostringtrueTicker of the payout currency in uppercase.
externalUserIdstringtrueUser ID provided by you.
ipstringtrueUser's IP address.
metadataobjecttrueMetadata object, which can contain any parameters you need:
  • If you don't provide the metadata object in the request, null will be returned in metadata in response.
  • If you specify an empty object in the request, an empty object will be returned in the response.
orderIdstringtrueInternal order ID provided by Fiat API.
externalOrderIdstringtrueOrder ID provided by you.
paymentMethodstringtrueThe payment method code. Possible values.
providerCodestringtrueThe On-Ramp provider code. Possible values.
redirectUrlstringtrueURL to the provider's purchase page.
refundAddressstringtrueRecipient refund address.
typestringtrueEnum: buy/sell.
Order type.
userAgentstringtrueUser Agent.
walletAddressstringtrueRecipient wallet address.
walletExtraIdstringtrueProperty required for wallet addresses of currencies that use an additional ID for transaction processing (XRP, XLM, EOS, BNB).
returnFailedUrlstringfalseReturn URL after a failed transaction.
returnSuccessUrlstringfalseReturn URL after a successfully completed transaction.

Learn more details about the returnSuccessUrl and returnFailedUrl parameters.

Sample response
application/json
{
"redirectUrl": "https://buy.moonpay.com/changelly?...",
"returnFailedUrl": "https://example.com/failed",
"returnSuccessUrl": "https://example.com/success",
"orderId": "f7ad32dd-8e1a-47e1-8a2b-72b0f7f0186a",
"externalUserId": "test_user",
"externalOrderId": "test_tx",
"providerCode": "moonpay",
"type": "buy",
"currencyFrom": "USD",
"currencyTo": "BTC",
"amountFrom": "150",
"country": "NL",
"state": "None",
"ip": "192.1.1.2",
"walletAddress": "...",
"walletExtraId": "None",
"refundAddress": "None",
"paymentMethod": "card",
"userAgent": "None",
"metadata": "None",
"createdAt": "2025-10-06T11:43:56.619Z"
}

Error response​

Error response parameters​

Check the error response schema.

Possible error types in the errorType item:

TypeDescription
currencySpecified currency pair is not supported by the provider.
initializeFailed to save transaction.
invalidOfferOn-Ramp provider returned an invalid offer.
outOfLimitsSpecified payin amount is less than the minimum or more than the maximum value for the fiat currency.
validationValidation error.
timeoutRequest to the provider was not completed in the allotted time.
paymentMethodSpecified payment method is not supported by the provider.
stateOffer requested for the United States, but the state parameter is not provided.
unavailableRequest failed at the provider's end.
unknownErrorUnknown error.
unsupportedCommissionRateOn-Ramp provider does not support commission rate.
unsupportedCountrySpecified country is not supported by the provider.
unsupportedExchangePairOn-Ramp provider does not support provided exchange pair.

The errorDetails item schema:

NameTypeRequiredDescription
causestringtrueError cause. For example, it can equal min or max for the outOfLimits error type.
valuestringtrueError value. For example, it can equal the min or max supported value for the outOfLimits error type.

Error codes​

CodeMessage
400Bad request
401Unauthorized
404Not found
422Unknown error
429Too many requests
500Internal server error
Bad Request
{
"errorType": "outOfLimits",
"errorMessage": "Limits error",
"errorDetails": null
}