comecerodocs

Convert an amount

GET
/fx/amount

Converts an amount from one currency to another at today's rate, with the same rules your shop uses for prices (your markup and rounding in Settings, Pricing). Pass a cart_id or invoice_id to use the rate saved on that cart or invoice instead of today's.

Secret and trusted tokens may call this. No permission is needed. Limited tokens are refused (403): use GET /fx/product in the browser.

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Query Parameters

amount*number

The amount to convert, in from_currency. Must be more than 0.

Range0 < value
from_currency*string

The ISO 4217 code of the currency of amount.

to_currency*string

The ISO 4217 code of the currency to convert to.

cart_id?string

Use the exchange rate saved on this cart.

invoice_id?string

Use the exchange rate saved on this invoice.

formatted?boolean

When true, the object also has a formatted child with amounts and dates as display text in the shopper's language and currency (for example $19.99 or November 7, 2026). The default is false. See Localized formatting.

Defaultfalse
show?string

Comma-separated fields to return; all others are left out. Use dot notation for child fields (customer.email). You cannot send show and hide together (400). See Customizing output.

hide?string

Comma-separated fields to leave out of the response. Use dot notation for child fields (customer.email). You cannot send show and hide together (400). See Customizing output.

Response Body

The converted amount.

application/json
  1. response

An amount converted to another currency.

amount?number

The converted amount, in currency.

currency?string

The ISO 4217 code of the currency the amount was converted to.

formatted?

Only present when you send formatted=true.

Example Request
curl -X GET 'https://api.comecero.com/api/v1/fx/amount?amount=20&from_currency=USD&to_currency=EUR'
Example Response
{  "amount": 18.4,  "currency": "EUR"}