Exchange
Every request listed on this page requires authorization to be successfully completed.
Get available exchange directions
GET
https://public.api.0xpay.app/merchants/exchange/available-directions/
You should use this endpoint before any exchange operations for following reasons:
1.Get available directions for exchange through 0xpay (tickers). 2.Get 0xpay exchange limitations (min, max). 3.Find the way how you should format your swaps (precision, step).
In response you'll get an array of two objects: target
and exchange
with info about available assets, limits, and amount precision.
amountStep
indicates the smallest portion of asset that can be added/substracted from the exchange amount, any smaller digits will not be accepted for the exchange.
For example: if amountStep=0.001
, then valid
amount: 5.005
, and anything containing smaller digits is not valid
: 1.0005
.
Estimate exchange
GET
https://public.api.0xpay.app/merchants/exchange/estimate/
You can use this endpoint to estimate your exchange for later creation
Query Parameters
Name | Type | Description |
---|---|---|
targetTicker* | string | Asset that you want to receive to your balance. Find values using "List all supported assets" request + Fiat ticker |
spendTicker* | string | Asset that you want to spend from your balance. Find values using "List all supported assets" request + Fiat ticker |
amount* | string | amount in decimal format |
side* | string | Your chosen direction, two possible values: |
price | string | actual price of the pair |
In response, you'll get details for your upcoming exchange:
Create exchange operation
POST
https://public.api.0xpay.app/merchants/exchange
Use this endpoint to create an exchange of two assets.
Status Notifications: After the Success response, 0xpay API will produce notifications according to status updates on your exchange.
Request Body
Name | Type | Description |
---|---|---|
spendTicker* | string | Ticker you want to spend (exchange) from your balance. Find values using "List all supported assets" request + Fiat ticker |
amount* | string | decimal format number presented as a string |
targetTicker* | string | Asset that you want to receive to your balance. Find values using "List all supported assets" request + Fiat ticker |
side* | string | Your chosen direction, two possible values: |
fee* | string | you can specify withdrawal fees that have to be greater than the actual fee, which can be useful for better fee calculation options on your side. If not the specified –fee will be set automatically |
price* | string | actual price of the pairs |
localId | string | if was specified error will be thrown if not unique, can be useful on your side to avoid the issue |
meta | string | metadata that you can define and catch it back later with notification |
Last updated