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:
Property | Required | Type | Description |
---|---|---|---|
from | yes | string | Base asset |
network | yes | string | Base asset network |
to | yes | string | Quote asset USD or EUR |
amount | yes | numerical | Base asset amount |
partner_data | required for smart contract | object | Partner data object |
sc_address | required for smart contract | string | The address of your smart contract |
sc_input_data | required for smart contract | string | Input data that will be used for the smart contract execution in hex format |
signature | required for smart contract | string | A 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_fee • ticker ). |
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
}
}
Updated 7 months ago
Documentation related to this page