Converter

Endpoint specification

The converter endpoint allows you to receive information on a transaction without going through the execution flow.


Request method: POST

Endpoint URL:

Sandbox: https://sandbox.wert.io/api/v3/partners/convert
Production: https://widget.wert.io/api/v3/partners/convert

Headers:

'X-Partner-ID: YOUR_PARTNER_ID' //string, required
'Content-Type: application/json'

The following properties are used when making a request:

PropertyRequiredTypeDescription
fromyesstringBase asset ( Fiat or Crypto) e.g BTC, ETH, USD, EUR
networkyesstringBase asset network
toyesstringQuote asset ( Fiat or Crypto) e.g BTC, ETH, USD, EUR
amountyesnumericalBase asset amount
partner_datarequired for smart contractobjectPartner data object
sc_addressrequired for smart contractstringThe address of your smart contract
sc_input_datarequired for smart contractstringInput data that will be used for the smart contract execution in hex format
signaturerequired for smart contractstringA digital signature used to encrypt the request to ensure you have sent it

Sample request for a crypto transaction

curl -X POST \
--url 'https://sandbox.wert.io/api/v3/partners/convert' \
-H 'Content-Type: application/json' \
-H 'X-Partner-ID: your-partner-id' \
-d '{
    "from": "ETH",
    "network": "sepolia",
    "to": "USD",
    "amount": 0.05
    }'

Sample request for a smart contract transaction

curl -X POST \
--url 'https://sandbox.wert.io/api/v3/partners/convert' \
-H 'Content-Type: application/json' \
-H 'X-Partner-ID: your-partner-id' \
-d '{
    "from": "ETH",
    "network": "sepolia",
    "to": "USD",
    "amount": 0.05,
    "partner_data": {
      "sc_address": "0xC545CEae428785a5AE77bfF262600deC7F7d76d2",
      "sc_input_data": "0x9dae76ea000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000",
      "signature": "0xd035046e8eda9b2c9c4413bfd31ed42b7df056108c83110aa8ae70f9ca167e1a2047d1b906afa66a770939dd074d1eff27b029ec2c27b39dc30a076e31221209"
    }
}'

Response

The endpoint will return the following information:

Parameter

Description

ticker

The rate at which cryptocurrency is being sold.

fee_percent

% fee taken by the service.

currency_amount

The final amount in fiat that the user will pay.

fee_amount

Amount paid in fiat to cover the service fee.

commodity_amount

The amount of cryptocurrency that the user will receive.

purchase_amount

The amount of fiat that will be used to purchase cryptocurrency
( purchase_amount = currency_amount - fee_amount - currency_miner_fee)

miner_fee

The amount of crypto that will be used to cover blockchain fees.

currency_miner_fee

Price of miner fee in fiat (currency_miner_fee = miner_feeticker).


Sample response:

{
    "status": "ok",
    "body": {
        "ticker": 2672.540034535,
        "fee_percent": 0.05,
        "currency_amount": 144.3,
        "fee_amount": 6.87,
        "commodity_amount": 0.05,
        "purchase_amount": 137.43,
        "miner_fee": 0.00142144,
        "currency_miner_fee": 3.8
    }
}

Documentation related to this page