LogoLogo
  • General
    • Welcome to 0xpay
    • Transaction Fees
    • Networks & Assets
  • Integration Cookbook
    • Getting Started
      • Merchant Setup
    • Receive assets
    • Send assets
    • Invoices
    • Exchanges
  • Public API
    • Authorization
      • Signature Examples
    • Endpoints
      • Merchant
      • Basic crypto operations
      • Crypto Invoices
      • Basic Fiat Operations
      • Fiat Invoices
      • Exchange
      • Exchange + Withdrawal
    • Notifications
      • Crypto Callbacks
      • Fiat Callbacks
      • Exchange Callbacks
    • JS/TS SDK
      • Getting started
      • Processing WebHook Notifications
      • Reference
  • Legal Info
    • Terms of Service
      • ANNEX 1: RISK DISCLOSURE
      • ANNEX 2: PROHIBITED BUSINESSES
      • ANNEX 3: HIGH-RISK STATES, TERRITORIES AND JURISDICTIONS
    • Privacy Policy
Powered by GitBook
On this page
  • Estimate Crypto Exchange+Withdrawal
  • Create Crypto Exchange+Withdrawal
  • Estimate Fiat Exchange+Withdrawal
  • Create Fiat Exchange+Withdrawal
  1. Public API
  2. Endpoints

Exchange + Withdrawal

PreviousExchangeNextNotifications

Last updated 1 year ago

Every request listed on this page requires authorization to be successfully completed.

Feature currently in beta

Estimate Crypto Exchange+Withdrawal

GET https://public.api.0xpay.app/merchants/exchange/withdrawals/crypto/estimate

You can use this endpoint to estimate your withdrawal with exchange for later

Query Parameters

Name
Type
Description

ticker*

string

Ticker for withdrawal.

Example: You want to spend (exchange) USDT and make a withdrawal in BTC (ticker value).

spendTicker*

string

Ticker you want to spend (exchange) from your balance.

amount*

string

Amount you want to spend or withdraw. For more details look at side field in this request.

side*

string

"spend" or "withdraw". Impacts amount field. When you want to withdraw the exact amount – specify the "withdraw" side. When you want to spend (exchange) an exact amount specify "exchange"

blockchain*

string

In response, you'll get details for your upcoming exchange:

{
    "withdraw": {
        "ticker": "USDT", //ticker you want to withdraw after exchange
        "amount": "1493.32" //amount you want to withdraw
        "fee": "123" //withdraw fee, included in withdraw.amount
    },
    "spend": {
        "ticker": "ETH", //ticker you want to spend
        "amount": "1" //amount you want to spend from your balance
    },
    "exchange": {
      "amount": "0.9", // amount to be exchanged
      "fee": "0.1" //exchange fee, included in spend.amount
    },
    "price": {
        "value": "1534.00000000", //actual price of the pair                                
        "pair": [
            "ETH",        //1 ETH == 1534 USDT
            "USDT"
        ]
    },
}
//List of Error codes with descriptions
//0 – Order validation error
//1 – Ticker pair not allowed
//2 – Withdraw amount too low
//3 – Not enough liquidity
{
    "code": 1,
    "description": "Ticker pair not allowed"
}

Create Crypto Exchange+Withdrawal

POST https://public.api.0xpay.app/merchants/exchange/withdrawals/crypto

Request Body

Name
Type
Description

ticker*

string

Ticker for withdrawal.

Example: You want to spend (exchange) USDT and make a withdrawal in BTC (ticker value).

amount*

string

Amount you want to spend or withdraw. For more details look at side field in this request.

side*

string

"spend" or "withdraw". Impacts amount field. When you want to withdraw the exact amount – specify the "withdraw" side. When you want to spend (exchange) an exact amount specify "exchange"

fee*

string

withdrawal fee

price*

string

actual price of the pairs

localId

string

meta

string

metadata that you can define and catch it back later with notification

blockchain*

string

to*

string

destination of withdrawal

spendTicker*

String

Ticker you want to spend (exchange) from your balance.

exchangeFee*

string

fee for exchange operation

{
    "id": "123e4567-e89b-12d3-a456-426614174000" //internal ID has been assigned to the transaction
}

Estimate Fiat Exchange+Withdrawal

GET https://public.api.0xpay.app/merchants/exchange/withdrawals/fiat/estimate

Query Parameters

Name
Type
Description

ticker*

string

Ticker for withdrawal.

Example: You want to spend (exchange) USDT and make a withdrawal in BTC (ticker value).

spendTicker*

string

Ticker you want to spend (exchange) from your balance.

amount*

string

Amount you want to spend or withdraw. For more details look at side field in this request.

side*

string

"spend" or "withdraw". Impacts amount field. When you want to withdraw the exact amount – specify the "withdraw" side. When you want to spend (exchange) an exact amount specify "exchange"

blockchain*

string

In response, you'll get details for your upcoming exchange:

{
    "withdraw": {
        "ticker": "UAH", //ticker you want to withdraw after exchange
        "amount": "32" //amount you want to withdraw
        "fee": "10.20213" //withdraw fee, included in withdraw.amount
    },
    "spend": {
        "ticker": "USDT", //ticker you want to spend
        "amount": "1" //amount you want to spend from your balance
    },
    "exchange": {
      "amount": "0.9", // amount to be exchanged
      "fee": "0.1" //exchange fee, included in spend.amount
    },
    "price": {
        "value": "32.000", //actual price of the pair                                
        "pair": [
            "USDT",        //1 USDT == 32 UAH
            "UAH"
        ]
    },
}
//List of Error codes with descriptions
//0 – Order validation error
//1 – Ticker pair not allowed
//2 – Withdraw amount too low
//3 – Not enough liquidity
{
    "code": 1,
    "description": "Ticker pair not allowed"
}

Create Fiat Exchange+Withdrawal

POST https://public.api.0xpay.app/merchants/exchange/withdrawals/fiat

Request Body

Name
Type
Description

ticker*

string

Ticker for withdrawal.

Example: You want to spend (exchange) USDT and make a withdrawal in UAH (ticker value).

amount*

string

Amount you want to spend or withdraw. For more details look at side field in this request.

side*

string

"spend" or "withdraw". Impacts amount field. When you want to withdraw the exact amount – specify the "withdraw" side. When you want to spend (exchange) an exact amount specify "exchange"

fee*

string

withdrawal fee

price*

string

actual price of the pairs

localId

string

meta

string

metadata that you can define and catch it back later with notification

to*

string

credit card number (destination of withdrawal)

spendTicker*

String

Ticker you want to spend (exchange) from your balance.

exchangeFee*

string

fee for exchange operation

{
    "id": "123e4567-e89b-12d3-a456-426614174000" //internal ID has been assigned to the transaction
}

Find values using

Find values using or

available values you can find ("API value" column)

This endpoint is used to create exchange withdrawal. Before sending this request, you should first .

Status Notifications: After the Success response, 0xpay API will produce according to status updates on your exchange.

Find values using

if was specified error will be thrown if not unique, can be useful on your side to avoid the issue

available values you can find ("API value" column)

Find values using or

You can use this endpoint to estimate your withdrawal with exchange for later

Find values using

Find values using or

available values you can find ("API value" column)

This endpoint is used to create exchange withdrawal. Before sending this request, you should first .

Status Notifications: After the Success response, 0xpay API will produce according to status updates on your exchange.

Find values using request

if was specified error will be thrown if not unique, can be useful on your side to avoid the issue

Find values using or

creation
estimate your exchange+withdrawal using the endpoint
creation
estimate your exchange+withdrawal using the endpoint
double-spend
double-spend
here
here
here
notifications
notifications
#list-all-supported-crypto-assets
#list-all-supported-crypto-assets
#list-all-supported-crypto-assets
#list-all-supported-crypto-assets
#list-all-supported-crypto-assets
#list-all-supported-crypto-assets
#list-all-supported-fiat-assets
#list-all-supported-fiat-assets
#list-all-supported-fiat-assets
#list-all-supported-fiat-assets
#list-all-supported-fiat-assets
#list-all-supported-fiat-assets