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 |
livemode | boolean | Whether this is a live ( |
location | string | API path to retrieve the current |
base | string | Base currency for rate request as three-letter ISO 4217 code. |
quote | string | Quote currency for rate request as three-letter ISO 4217 code. This is the funding currency for account (i.e. for Thailand, |
rate | float | Current exchange rate for currency pair. |
Example
-
JSON Response
{ "object": "forex", "location": "/forex/usd", "livemode": false, "base": "USD", "quote": "THB", "rate": 30.4847017 }
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#
- java
- 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}");
Request<Forex> request = new Forex.GetRequestBuilder("usd").build(); Forex forex = client().sendRequest(request); System.out.printf("Forex rate: %f", forex.getRate());
import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" forex = omise.Forex.retrieve("usd")
Omise.configure(secret_key: "skey_test_4xs8breq3htbkj03d2x") Omise.Forex.retrieve("usd")