Skip to main content
POST
Create an On-Ramp Order
The fiat-to-crypto on-ramp converts local fiat currency into cryptocurrency for your user. Specify the source fiat, the target crypto, and the payment method via paymentId. Fix the order amount in either fiat (fiatAmount) or crypto (cryptoAmount); if you send both, fiatAmount takes precedence. To lock the rate, pass a quoteId from the Quote API; without one, the order is priced at the current rate when it is created. The response returns an orderId you can use to track the order through its lifecycle via the Get Order and List Orders endpoints.

Endpoint

Use https://api-test.velafi.com/v2/order/fiat_to_crypto for sandbox testing.

Request Headers

Request Body Parameters

string
required
Full country name for the on-ramp (e.g., "Mexico", "Brazil"). Must match the country supported by the chosen paymentId.
string
required
Ticker symbol of the target cryptocurrency (e.g., "USDT", "USDC", "BTC").
string
required
ISO 4217 fiat currency code the user pays with (e.g., "MXN", "BRL", "COP").
integer
required
Numeric ID of the payment method used for the fiat deposit. See the Payment Method IDs table in the Payment Templates reference.
string
Your own order reference ID, up to 40 characters. It must be unique across all fiat_to_crypto and crypto_to_fiat orders on your account; a second create request with the same clientId is rejected. It is returned in Get Order responses and can be used instead of orderId to look the order up. See Idempotency and retries.
integer
required
Numeric ID of the merchant the order belongs to. Requests without a valid merchantId are rejected.
decimal
Amount of fiat currency the user pays (e.g., 1000.00). Provide fiatAmount or cryptoAmount; if you send both, fiatAmount takes precedence.
decimal
Amount of cryptocurrency the user receives (e.g., 46.73). Ignored when a positive fiatAmount is also sent.
string
Optional free-text note attached to the order.
string
Alias of the virtual account to use for the fiat deposit. Required for virtual-account-based payment methods.
string
Quote ID from the Quote API to lock in a specific exchange rate. Omit to use the live spot rate.
object
Additional payment-specific fields required for certain payment methods.

Response Fields

integer
Response status code. 200 indicates success.
string
Human-readable response message.
object
Order result object.

Example

After creating the order, poll GET /v2/order/detail?orderId={orderId}&orderType=fiat_to_crypto to monitor its status. A new order starts in status: 40 (pending payment), or in 10, 11, or 31 when compliance review or supporting documents are required. Orders on automatic payment methods move to status: 50 (paid) through VelaFi’s bank integration. For manual payment methods, call POST /v2/order/confirm after the transfer is sent to mark the order as paid.

Idempotency and retries

Use clientId to make order creation safe to retry.
  • clientId is optional. When you send it, it must be at most 40 characters and unique on your account across all fiat_to_crypto and crypto_to_fiat orders, for all of your merchants.
  • A create request that reuses an existing clientId is rejected with a repeated-submission error, and no new order is created. The response does not return the original order; look it up instead.
  • A clientId stays bound to its order permanently, including after the order is canceled. Use a new clientId for a new order.
  • Look up an order by clientId with GET /v2/order/detail?orderType=fiat_to_crypto&clientId={clientId}.
If a create request times out or returns no response:
  1. Call GET /v2/order/detail with the same orderType and clientId.
  2. If the order is found, the original request succeeded. Do not create it again.
  3. If it is not found, retry with the same clientId. If the first request did create the order in the meantime, the retry is rejected as a duplicate instead of creating a second order.
A quoteId can be consumed by a create request that is then rejected. Request a new quote before you retry.