Converter

The converter endpoint allows you to receive information on a transaction without going through the execution flow. The endpoint is available in both sandbox and production at the following URLs:

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


The endpoint specification is as follows:

Request method: POST

Media type: application/json

Headers:

  • X-Partner-ID: string (required) - The partner ID which you were provided
  • Content-Type: application/json

And the following properties are used when making a request:

  • from : string (required) - Base asset
  • to : string (required) - Quote asset
  • amount : numerical (required) - Base asset amount
  • partner_data : object (required) Partner data object
    • address : string (required for crypto) - Wallet address where the asset will be sent
    • sc_id : string (required for smart contract) - uuid4.hex generated by you
    • pk_id : string (required for smart contract)- ID of the public key (usually "key1")
    • sc_address : string (required for smart contract) - The address of the smart contract
    • sc_input_data : string (required for smart contract) - Input data that will be used for the smart contract execution, in hex format
    • signature : string (required for smart contract) - Digital signature used to encrypt the request to ensure it has been sent by you

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",
    "to": "USD",
    "amount": 0.05,
    "partner_data": {
      "address": "0xC545CEae428785a5AE77bfF262600deC7F7d76d2"}
    }'

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",
    "to": "USD",
    "amount": 0.05,
    "partner_data": {
      "sc_id": "0885a9e7361a4ab8941e86cb0af370d6",
      "pk_id": "key1",
      "sc_address": "0xC545CEae428785a5AE77bfF262600deC7F7d76d2",
      "sc_input_data": "0x9dae76ea000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000",
      "signature": "0xd035046e8eda9b2c9c4413bfd31ed42b7df056108c83110aa8ae70f9ca167e1a2047d1b906afa66a770939dd074d1eff27b029ec2c27b39dc30a076e31221209"
    }
}'

Response

The endpoint will return the following information:

ParameterDescription
tickerRate at which cryptocurrency is being sold
fee_percent% fee taken by the service
fee_amountAmount paid in fiat to cover the service fee
currency_amountThe final amount in fiat that will be paid by the user
commodity_amountThe amount of cryptocurrency that will be received by the user
purchase_amountThe amount of fiat that will be used to purchase cryptocurrency
(= currency_amount - fee_amount - currency_miner_fee)
miner_feeThe amount of crypto that will be used to cover blockchain fees
currency_miner_feePrice of miner fee in fiat (= miner_fee • ticker)

Sample response

{
  "status": "ok",
  "body": {
    "ticker": 1555.11,
    "fee_percent": 0.05,
    "currency_amount": 82.02,
    "fee_amount": 3.9,
    "commodity_amount": 0.05,
    "purchase_amount": 78.12,
    "miner_fee": 0.00023489,
    "currency_miner_fee": 0.37
  }
}