Forex API
Retrieve the real-time currency exchange rate used in conversions. The rate used is approximately 2-4% above the daily mid-market rate. Endpoint is only accessible if multi-currency transactions are enabled.
Attributes
Name | Type | Description |
---|---|---|
object | string | The string |
location | string | API path to retrieve the current |
from | string | Base currency for rate request as three-letter ISO 4217 code. |
rate | float | Current exchange rate for currency pair. |
to | string | Quote currency for rate request as three-letter ISO 4217 code. |
Example
-
JSON Response
{ "object": "forex", "from": "usd", "to": "thb", "rate": 32.85436545, "location": "/forex/usd" }
Retrieve the forex
- GET https://api.omise.co/forex/{currency}Returns the current foreign exchange rate. This endpoint is only accessible if multi-currency transactions are enabled.
Example
-
Retrieve the USD/THB exchange rate
- curl
- php
- ruby
- C#
- python
- elixir
curl https://api.omise.co/forex/usd \ -u $OMISE_SECRET_KEY:
<?php $forex = OmiseForex::retrieve('usd');
require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" forex = Omise::Forex.from("USD")
var rate = await Client.Forex.Get("usd"); Console.WriteLine($"conversion from USD to THB: {rate.Rate}");
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" forex = omise.Forex.retrieve("usd")
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Forex.retrieve("usd")