Access real-time foreign exchange rates with MobiCard's Forex Rates API. Get accurate currency conversion data for 160+ currencies worldwide, updated in real-time for financial applications, e-commerce platforms, and payment systems.
Retrieve comprehensive forex rate data including base currency rates, historical comparisons, and real-time exchange values. Perfect for payment processing, financial reporting, multi-currency pricing, and international transaction calculations.
Retrieve real-time foreign exchange rates for global currencies. The API returns exchange rate data for a specified base currency against all supported currencies or a single target currency.
Generate a signed JWT token with embedded request.
Send currency query parameters to receive real-time forex rate information. Specify a target currency or retrieve all available rates.
<?php
// Mandatory claims
$mobicard_version = "2.0";
$mobicard_mode = "TEST"; // Use "LIVE" for production
$mobicard_merchant_id = "4";
$mobicard_api_key = "YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9";
$mobicard_secret_key = "NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9";
$mobicard_token_id = abs(rand(1000000,1000000000));
$mobicard_token_id = "$mobicard_token_id";
$mobicard_txn_reference = abs(rand(1000000,1000000000)); // Your reference
$mobicard_txn_reference = "$mobicard_txn_reference";
$mobicard_service_id = "20000"; // Card Services ID
$mobicard_service_type = "FOREXRATES";
$mobicard_base_currency = "USD"; // Default USD base currency. Options: (USD, EUR, JPY, GBP, CNY).
$mobicard_query_currency = ""; // 3-letter ISO code or leave empty for all currencies
// Create JWT Header
$mobicard_jwt_header = [
"typ" => "JWT",
"alg" => "HS256"
];
$mobicard_jwt_header = rtrim(strtr(base64_encode(json_encode($mobicard_jwt_header)), '+/', '-_'), '=');
// Create JWT Payload
$mobicard_jwt_payload = array(
"mobicard_version" => "$mobicard_version",
"mobicard_mode" => "$mobicard_mode",
"mobicard_merchant_id" => "$mobicard_merchant_id",
"mobicard_api_key" => "$mobicard_api_key",
"mobicard_service_id" => "$mobicard_service_id",
"mobicard_service_type" => "$mobicard_service_type",
"mobicard_token_id" => "$mobicard_token_id",
"mobicard_txn_reference" => "$mobicard_txn_reference",
"mobicard_base_currency" => "$mobicard_base_currency",
"mobicard_query_currency" => "$mobicard_query_currency"
);
$mobicard_jwt_payload = rtrim(strtr(base64_encode(json_encode($mobicard_jwt_payload)), '+/', '-_'), '=');
// Generate Signature
$header_payload = $mobicard_jwt_header . '.' . $mobicard_jwt_payload;
$mobicard_jwt_signature = rtrim(strtr(base64_encode(hash_hmac('sha256', $header_payload, $mobicard_secret_key, true)), '+/', '-_'), '=');
// Create Final JWT
$mobicard_auth_jwt = "$mobicard_jwt_header.$mobicard_jwt_payload.$mobicard_jwt_signature";
// Make API Call
$mobicard_request_access_token_url = "https://mobicardsystems.com/api/v1/forex_rates";
$mobicard_curl_post_data = array('mobicard_auth_jwt' => $mobicard_auth_jwt);
$curl_mobicard = curl_init();
curl_setopt($curl_mobicard, CURLOPT_URL, $mobicard_request_access_token_url);
curl_setopt($curl_mobicard, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_mobicard, CURLOPT_POST, true);
curl_setopt($curl_mobicard, CURLOPT_POSTFIELDS, json_encode($mobicard_curl_post_data));
curl_setopt($curl_mobicard, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl_mobicard, CURLOPT_SSL_VERIFYPEER, false);
$mobicard_curl_response = curl_exec($curl_mobicard);
curl_close($curl_mobicard);
// Parse Response
$response_data = json_decode($mobicard_curl_response, true);
if(isset($response_data) && is_array($response_data)) {
if($response_data['status'] === 'SUCCESS') {
// Access forex rate information
$base_currency = $response_data['base_currency'];
$timestamp = $response_data['timestamp'];
$forex_rates = $response_data['forex_rates'];
echo "Forex Rates Retrieved Successfully!
";
echo "Base Currency: " . $base_currency . "
";
echo "Timestamp: " . $timestamp . "
";
// Display all rates or specific rate
if(!empty($mobicard_query_currency)) {
$currency_pair = $base_currency . $mobicard_query_currency;
if(isset($forex_rates[$currency_pair])) {
echo "Exchange Rate (" . $base_currency . "/" . $mobicard_query_currency . "): " . $forex_rates[$currency_pair] . "
";
}
} else {
echo "Total Currencies Available: " . count($forex_rates) . "
";
// Display first 5 rates as example
$counter = 0;
foreach($forex_rates as $pair => $rate) {
if($counter < 5) {
echo $pair . ": " . $rate . "
";
$counter++;
}
}
}
} else {
echo "Error: " . $response_data['status_message'] . " (Code: " . $response_data['status_code'] . ")";
}
} else {
echo "Error: Invalid API response";
}
#!/bin/bash
# Configuration
MOBICARD_VERSION="2.0"
MOBICARD_MODE="TEST"
MOBICARD_MERCHANT_ID="4"
MOBICARD_API_KEY="YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9"
MOBICARD_SECRET_KEY="NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9"
MOBICARD_TOKEN_ID=$(shuf -i 1000000-1000000000 -n 1)
MOBICARD_TXN_REFERENCE=$(shuf -i 1000000-1000000000 -n 1)
MOBICARD_SERVICE_ID="20000"
MOBICARD_SERVICE_TYPE="FOREXRATES"
MOBICARD_BASE_CURRENCY="USD"
MOBICARD_QUERY_CURRENCY="" # 3-letter ISO code or leave empty for all currencies
# Create JWT Header
JWT_HEADER=$(echo -n '{"typ":"JWT","alg":"HS256"}' | base64 | tr '+/' '-_' | tr -d '=')
# Create JWT Payload
PAYLOAD_JSON=$(cat << EOF
{
"mobicard_version": "$MOBICARD_VERSION",
"mobicard_mode": "$MOBICARD_MODE",
"mobicard_merchant_id": "$MOBICARD_MERCHANT_ID",
"mobicard_api_key": "$MOBICARD_API_KEY",
"mobicard_service_id": "$MOBICARD_SERVICE_ID",
"mobicard_service_type": "$MOBICARD_SERVICE_TYPE",
"mobicard_token_id": "$MOBICARD_TOKEN_ID",
"mobicard_txn_reference": "$MOBICARD_TXN_REFERENCE",
"mobicard_base_currency": "$MOBICARD_BASE_CURRENCY",
"mobicard_query_currency": "$MOBICARD_QUERY_CURRENCY"
}
EOF
)
JWT_PAYLOAD=$(echo -n "$PAYLOAD_JSON" | base64 | tr '+/' '-_' | tr -d '=')
# Generate Signature
HEADER_PAYLOAD="$JWT_HEADER.$JWT_PAYLOAD"
JWT_SIGNATURE=$(echo -n "$HEADER_PAYLOAD" | openssl dgst -sha256 -hmac "$MOBICARD_SECRET_KEY" -binary | base64 | tr '+/' '-_' | tr -d '=')
# Create Final JWT
MOBICARD_AUTH_JWT="$JWT_HEADER.$JWT_PAYLOAD.$JWT_SIGNATURE"
# Make API Call
API_URL="https://mobicardsystems.com/api/v1/forex_rates"
RESPONSE=$(curl -X POST "$API_URL" \
-H "Content-Type: application/json" \
-d "{\"mobicard_auth_jwt\":\"$MOBICARD_AUTH_JWT\"}" \
--silent)
echo "$RESPONSE" | python -m json.tool
import json
import base64
import hmac
import hashlib
import random
import requests
class MobicardForexRates:
def __init__(self, merchant_id, api_key, secret_key):
self.mobicard_version = "2.0"
self.mobicard_mode = "TEST"
self.mobicard_merchant_id = merchant_id
self.mobicard_api_key = api_key
self.mobicard_secret_key = secret_key
self.mobicard_service_id = "20000"
self.mobicard_service_type = "FOREXRATES"
self.mobicard_base_currency = "USD"
self.mobicard_token_id = str(random.randint(1000000, 1000000000))
self.mobicard_txn_reference = str(random.randint(1000000, 1000000000))
def get_forex_rates(self, query_currency=""):
"""Get forex rates for all currencies or specific currency"""
# Create JWT Header
jwt_header = {"typ": "JWT", "alg": "HS256"}
encoded_header = base64.urlsafe_b64encode(
json.dumps(jwt_header).encode()
).decode().rstrip('=')
# Create JWT Payload
jwt_payload = {
"mobicard_version": self.mobicard_version,
"mobicard_mode": self.mobicard_mode,
"mobicard_merchant_id": self.mobicard_merchant_id,
"mobicard_api_key": self.mobicard_api_key,
"mobicard_service_id": self.mobicard_service_id,
"mobicard_service_type": self.mobicard_service_type,
"mobicard_token_id": self.mobicard_token_id,
"mobicard_txn_reference": self.mobicard_txn_reference,
"mobicard_base_currency": self.mobicard_base_currency,
"mobicard_query_currency": query_currency
}
encoded_payload = base64.urlsafe_b64encode(
json.dumps(jwt_payload).encode()
).decode().rstrip('=')
# Generate Signature
header_payload = f"{encoded_header}.{encoded_payload}"
signature = hmac.new(
self.mobicard_secret_key.encode(),
header_payload.encode(),
hashlib.sha256
).digest()
encoded_signature = base64.urlsafe_b64encode(signature).decode().rstrip('=')
jwt_token = f"{encoded_header}.{encoded_payload}.{encoded_signature}"
# Make API Call
url = "https://mobicardsystems.com/api/v1/forex_rates"
payload = {"mobicard_auth_jwt": jwt_token}
try:
response = requests.post(url, json=payload, verify=False, timeout=30)
response_data = response.json()
if response_data.get('status') == 'SUCCESS':
return {
'status': 'SUCCESS',
'base_currency': response_data['base_currency'],
'timestamp': response_data['timestamp'],
'forex_rates': response_data['forex_rates'],
'raw_response': response_data
}
else:
return {
'status': 'ERROR',
'status_code': response_data.get('status_code'),
'status_message': response_data.get('status_message')
}
except Exception as e:
return {'status': 'ERROR', 'error_message': str(e)}
# Usage
forex_rates = MobicardForexRates(
merchant_id="4",
api_key="YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9",
secret_key="NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9"
)
# Get all forex rates
result = forex_rates.get_forex_rates()
# Get specific currency rate
# result = forex_rates.get_forex_rates("EUR")
if result['status'] == 'SUCCESS':
print(f"Base Currency: {result['base_currency']}")
print(f"Timestamp: {result['timestamp']}")
print(f"Total Rates Available: {len(result['forex_rates'])}")
# Display sample rates
print("\nSample Exchange Rates:")
for i, (pair, rate) in enumerate(result['forex_rates'].items()):
if i < 5:
print(f"{pair}: {rate}")
else:
print(f"Error: {result.get('status_message')}")
const crypto = require('crypto');
const axios = require('axios');
class MobicardForexRates {
constructor(merchantId, apiKey, secretKey) {
this.mobicardVersion = "2.0";
this.mobicardMode = "TEST";
this.mobicardMerchantId = merchantId;
this.mobicardApiKey = apiKey;
this.mobicardSecretKey = secretKey;
this.mobicardServiceId = "20000";
this.mobicardServiceType = "FOREXRATES";
this.mobicardBaseCurrency = "USD";
this.mobicardTokenId = Math.floor(Math.random() * (1000000000 - 1000000 + 1)) + 1000000;
this.mobicardTxnReference = Math.floor(Math.random() * (1000000000 - 1000000 + 1)) + 1000000;
}
generateJWT(queryCurrency = "") {
const jwtHeader = { typ: "JWT", alg: "HS256" };
const encodedHeader = Buffer.from(JSON.stringify(jwtHeader)).toString('base64url');
const jwtPayload = {
mobicard_version: this.mobicardVersion,
mobicard_mode: this.mobicardMode,
mobicard_merchant_id: this.mobicardMerchantId,
mobicard_api_key: this.mobicardApiKey,
mobicard_service_id: this.mobicardServiceId,
mobicard_service_type: this.mobicardServiceType,
mobicard_token_id: this.mobicardTokenId.toString(),
mobicard_txn_reference: this.mobicardTxnReference.toString(),
mobicard_base_currency: this.mobicardBaseCurrency,
mobicard_query_currency: queryCurrency
};
const encodedPayload = Buffer.from(JSON.stringify(jwtPayload)).toString('base64url');
const headerPayload = `${encodedHeader}.${encodedPayload}`;
const signature = crypto.createHmac('sha256', this.mobicardSecretKey)
.update(headerPayload)
.digest('base64url');
return `${encodedHeader}.${encodedPayload}.${signature}`;
}
async getForexRates(queryCurrency = "") {
try {
const jwtToken = this.generateJWT(queryCurrency);
const url = "https://mobicardsystems.com/api/v1/forex_rates";
const payload = { mobicard_auth_jwt: jwtToken };
const response = await axios.post(url, payload, {
httpsAgent: new (require('https').Agent)({ rejectUnauthorized: false })
});
const responseData = response.data;
if (responseData.status === 'SUCCESS') {
return {
status: 'SUCCESS',
baseCurrency: responseData.base_currency,
timestamp: responseData.timestamp,
forexRates: responseData.forex_rates,
rawResponse: responseData
};
} else {
return {
status: 'ERROR',
statusCode: responseData.status_code,
statusMessage: responseData.status_message
};
}
} catch (error) {
return {
status: 'ERROR',
errorMessage: error.message
};
}
}
}
// Usage
async function main() {
const forexRates = new MobicardForexRates(
"4",
"YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9",
"NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9"
);
// Get all forex rates
const result = await forexRates.getForexRates();
// Get specific currency rate
// const result = await forexRates.getForexRates("EUR");
if (result.status === 'SUCCESS') {
console.log("Forex Rates Retrieved Successfully!");
console.log(`Base Currency: ${result.baseCurrency}`);
console.log(`Timestamp: ${result.timestamp}`);
console.log(`Total Rates Available: ${Object.keys(result.forexRates).length}`);
console.log("\nSample Exchange Rates:");
const rates = result.forexRates;
const pairs = Object.keys(rates);
for (let i = 0; i < Math.min(5, pairs.length); i++) {
console.log(`${pairs[i]}: ${rates[pairs[i]]}`);
}
} else {
console.log(`Error: ${result.statusMessage}`);
}
}
main();
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;
import java.util.Random;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class MobicardForexRates {
private final String mobicardVersion = "2.0";
private final String mobicardMode = "TEST";
private final String mobicardMerchantId;
private final String mobicardApiKey;
private final String mobicardSecretKey;
private final String mobicardServiceId = "20000";
private final String mobicardServiceType = "FOREXRATES";
private final String mobicardBaseCurrency = "USD";
private final String mobicardTokenId;
private final String mobicardTxnReference;
private final Gson gson = new Gson();
public MobicardForexRates(String merchantId, String apiKey, String secretKey) {
this.mobicardMerchantId = merchantId;
this.mobicardApiKey = apiKey;
this.mobicardSecretKey = secretKey;
Random random = new Random();
this.mobicardTokenId = String.valueOf(random.nextInt(900000000) + 1000000);
this.mobicardTxnReference = String.valueOf(random.nextInt(900000000) + 1000000);
}
public String generateJWT(String queryCurrency) throws Exception {
Map jwtHeader = new HashMap<>();
jwtHeader.put("typ", "JWT");
jwtHeader.put("alg", "HS256");
String encodedHeader = base64UrlEncode(gson.toJson(jwtHeader));
Map jwtPayload = new HashMap<>();
jwtPayload.put("mobicard_version", mobicardVersion);
jwtPayload.put("mobicard_mode", mobicardMode);
jwtPayload.put("mobicard_merchant_id", mobicardMerchantId);
jwtPayload.put("mobicard_api_key", mobicardApiKey);
jwtPayload.put("mobicard_service_id", mobicardServiceId);
jwtPayload.put("mobicard_service_type", mobicardServiceType);
jwtPayload.put("mobicard_token_id", mobicardTokenId);
jwtPayload.put("mobicard_txn_reference", mobicardTxnReference);
jwtPayload.put("mobicard_base_currency", mobicardBaseCurrency);
jwtPayload.put("mobicard_query_currency", queryCurrency);
String encodedPayload = base64UrlEncode(gson.toJson(jwtPayload));
String headerPayload = encodedHeader + "." + encodedPayload;
String signature = generateHMAC(headerPayload, mobicardSecretKey);
return encodedHeader + "." + encodedPayload + "." + signature;
}
public JsonObject getForexRates(String queryCurrency) throws Exception {
String jwtToken = generateJWT(queryCurrency);
HttpClient client = HttpClient.newHttpClient();
Map requestBody = new HashMap<>();
requestBody.put("mobicard_auth_jwt", jwtToken);
String jsonBody = gson.toJson(requestBody);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://mobicardsystems.com/api/v1/forex_rates"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonBody))
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
return gson.fromJson(response.body(), JsonObject.class);
}
private String base64UrlEncode(String data) {
return Base64.getUrlEncoder().withoutPadding().encodeToString(data.getBytes());
}
private String generateHMAC(String data, String key) throws Exception {
Mac sha256Hmac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(), "HmacSHA256");
sha256Hmac.init(secretKey);
byte[] hmacBytes = sha256Hmac.doFinal(data.getBytes());
return base64UrlEncode(new String(hmacBytes));
}
public static void main(String[] args) {
try {
MobicardForexRates forexRates = new MobicardForexRates(
"4",
"YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9",
"NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9"
);
// Get all forex rates
String queryCurrency = ""; // Empty for all currencies
// Get specific currency rate
// String queryCurrency = "EUR";
JsonObject result = forexRates.getForexRates(queryCurrency);
if (result.has("status")) {
String status = result.get("status").getAsString();
if ("SUCCESS".equals(status)) {
System.out.println("Forex Rates Retrieved Successfully!");
System.out.println("Base Currency: " +
result.get("base_currency").getAsString());
System.out.println("Timestamp: " +
result.get("timestamp").getAsString());
if (result.has("forex_rates")) {
JsonObject rates = result.getAsJsonObject("forex_rates");
System.out.println("Total Rates Available: " +
rates.size());
System.out.println("\nSample Exchange Rates:");
int count = 0;
for (String pair : rates.keySet()) {
if (count < 5) {
System.out.println(pair + ": " +
rates.get(pair).getAsString());
count++;
}
}
}
} else {
System.out.println("Forex Rates Request Failed!");
if (result.has("status_message")) {
System.out.println("Error: " + result.get("status_message").getAsString());
}
}
}
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
}
}
}
The Forex Rates API returns comprehensive currency exchange rate information upon successful request.
{
"status": "SUCCESS",
"status_code": "200",
"status_message": "SUCCESS",
"mobicard_txn_reference": "694329793",
"mobicard_token_id": "325026456",
"base_currency": "USD",
"timestamp": "2026-01-29 16:31:01",
"forex_rates": {
"USDAED": 3.6725,
"USDAFN": 65.786799,
"USDALL": 80.757863,
"USDAMD": 379.022763,
"USDANG": 1.79,
"USDAOA": 919.969957,
"USDARS": 1452.25,
"USDAUD": 1.426189,
"USDAWG": 1.79,
"USDAZN": 1.701021,
"USDBAM": 1.634147,
"USDBBD": 2,
"USDBDT": 122.172587,
"USDBGN": 1.586662,
"USDBHD": 0.376,
"USDBIF": 2965.410723,
"USDBMD": 1,
"USDBND": 1.262208,
"USDBOB": 6.921391,
"USDBRL": 5.185441,
"USDBSD": 1,
"USDBTN": 91.98174,
"USDBWP": 13.341705,
"USDBYN": 2.842833,
"USDBZD": 2,
"USDCAD": 1.355899,
"USDCDF": 2273.753865,
"USDCHF": 0.767528,
"USDCLF": 0.021751,
"USDCLP": 859.720171,
"USDCNH": 6.945914,
"USDCNY": 6.956121,
"USDCOP": 3658.806441,
"USDCRC": 496.272755,
"USDCUP": 24,
"USDCVE": 92.12927,
"USDCZK": 20.316824,
"USDDJF": 177.721,
"USDDKK": 6.233971,
"USDDOP": 62.768691,
"USDDZD": 129.194681,
"USDEGP": 46.948579,
"USDERN": 15,
"USDETB": 154.573997,
"USDEUR": 0.835547,
"USDFJD": 2.200791,
"USDFKP": 0.724654,
"USDFOK": 6.235422,
"USDGBP": 0.724665,
"USDGEL": 2.693268,
"USDGGP": 0.724654,
"USDGHS": 10.945947,
"USDGIP": 0.724654,
"USDGMD": 74.161993,
"USDGNF": 8758.161855,
"USDGTQ": 7.675976,
"USDGYD": 209.303852,
"USDHKD": 7.801394,
"USDHNL": 26.377972,
"USDHRK": 6.29527,
"USDHTG": 130.927308,
"USDHUF": 318.110635,
"USDIDR": 16739.365495,
"USDILS": 3.093639,
"USDIMP": 0.724654,
"USDINR": 92.007801,
"USDIQD": 1309.869488,
"USDIRR": 1076714.568598,
"USDISK": 121.115831,
"USDJEP": 0.724654,
"USDJMD": 156.829412,
"USDJOD": 0.709,
"USDJPY": 153.126485,
"USDKES": 129.036529,
"USDKGS": 87.469459,
"USDKHR": 4019.241365,
"USDKID": 1.426174,
"USDKMF": 411.051827,
"USDKRW": 1431.350768,
"USDKWD": 0.306041,
"USDKYD": 0.833333,
"USDKZT": 504.11722,
"USDLAK": 21523.427823,
"USDLBP": 89500,
"USDLKR": 309.753929,
"USDLRD": 184.387941,
"USDLSL": 15.829801,
"USDLYD": 6.313392,
"USDMAD": 9.041151,
"USDMDL": 16.816366,
"USDMGA": 4471.14254,
"USDMKD": 51.667049,
"USDMMK": 2101.816387,
"USDMNT": 3580.249923,
"USDMOP": 8.035377,
"USDMRU": 40.008586,
"USDMUR": 45.158538,
"USDMVR": 15.462816,
"USDMWK": 1739.631322,
"USDMXN": 17.193052,
"USDMYR": 3.918623,
"USDMZN": 63.725422,
"USDNAD": 15.829801,
"USDNGN": 1396.935234,
"USDNIO": 36.785282,
"USDNOK": 9.609191,
"USDNPR": 147.170784,
"USDNZD": 1.654228,
"USDOMR": 0.384497,
"USDPAB": 1,
"USDPEN": 3.343101,
"USDPGK": 4.277403,
"USDPHP": 58.768416,
"USDPKR": 279.923344,
"USDPLN": 3.513339,
"USDPYG": 6725.725173,
"USDQAR": 3.64,
"USDRON": 4.253808,
"USDRSD": 97.999137,
"USDRUB": 76.344018,
"USDRWF": 1459.163486,
"USDSAR": 3.75,
"USDSBD": 7.967784,
"USDSCR": 14.153426,
"USDSDG": 544.164471,
"USDSEK": 8.8405,
"USDSGD": 1.262196,
"USDSHP": 0.724654,
"USDSLE": 24.320946,
"USDSLL": 24320.946467,
"USDSOS": 570.843635,
"USDSRD": 38.101163,
"USDSSP": 4619.156454,
"USDSTN": 20.470386,
"USDSYP": 113.658694,
"USDSZL": 15.829801,
"USDTHB": 31.093452,
"USDTJS": 9.333489,
"USDTMT": 3.502138,
"USDTND": 2.83317,
"USDTOP": 2.360847,
"USDTRY": 43.440355,
"USDTTD": 6.780477,
"USDTVD": 1.426174,
"USDTWD": 31.319686,
"USDTZS": 2548.372041,
"USDUAH": 42.803345,
"USDUGX": 3571.732705,
"USDUYU": 37.593616,
"USDUZS": 12142.854346,
"USDVES": 363.6623,
"USDVND": 26017.593918,
"USDVUV": 119.117457,
"USDWST": 2.692888,
"USDXAF": 548.069102,
"USDXCD": 2.7,
"USDXCG": 1.79,
"USDXDR": 0.71122,
"USDXOF": 548.069102,
"USDXPF": 99.704984,
"USDYER": 238.07384,
"USDZAR": 15.830167,
"USDZMW": 19.85584,
"USDZWG": 25.6259,
"USDZWL": 25.6259,
"USDUSD": 1
}
}
{
"status": "SUCCESS",
"status_code": "200",
"status_message": "SUCCESS",
"mobicard_txn_reference": "794521368",
"base_currency": "USD",
"timestamp": "2026-01-29 16:32:15",
"forex_rates": {
"USDEUR": 0.835547,
"USDUSD": 1
}
}
status: Always "SUCCESS" or "FAILED" - use this to determine subsequent actionsstatus_code: HTTP status code (200 for success)base_currency: The base currency used for exchange rates (default: USD). Options: (USD, EUR, JPY, GBP, CNY).timestamp: Timestamp when rates were retrievedforex_rates: Object containing currency pair exchange ratesforex_rates.USDEUR: Exchange rate from USD to EUR (example: 0.835547 means 1 USD = 0.835547 EUR)forex_rates.USDUSD: Always included with value 1 (base currency to itself)Error responses have a simplified format with only 3 fields of essential information.
Use the "status" field to determine if any API request is successful or not. The value is always either "SUCCESS" or "FAILED".
{
"status": "FAILED",
"status_code": "400",
"status_message": "BAD REQUEST"
}
Complete list of status codes returned by the API.
| Status Code | Status | Status Message Interpretation | Action Required |
|---|---|---|---|
| 200 | SUCCESS | SUCCESS - Forex rates retrieved successfully | Process the response data |
| 400 | FAILED | BAD REQUEST - Invalid parameters or malformed request | Check request parameters |
| 429 | FAILED | TOO MANY REQUESTS - Rate limit exceeded | Wait before making more requests |
| 250 | FAILED | INSUFFICIENT TOKENS - Token account balance insufficient | Top up your account |
| 500 | FAILED | UNAVAILABLE - Server error | Try again later or contact support |
| 430 | FAILED | TIMEOUT - Request timed out | Issue new token and retry |
Complete reference of all request parameters used in the Forex Rates API.
| Parameter | Required | Description | Example Value | Notes |
|---|---|---|---|---|
mobicard_version |
Yes | API version | "2.0" | Fixed value |
mobicard_mode |
Yes | Environment mode | "TEST" or "LIVE" | Use TEST for development |
mobicard_merchant_id |
Yes | Your merchant ID | "" | Provided by MobiCard |
mobicard_api_key |
Yes | Your API key | "" | Provided by MobiCard |
mobicard_secret_key |
Yes | Your secret key | "" | Provided by MobiCard |
mobicard_service_id |
Yes | Service ID | "20000" | Fixed value for card services |
mobicard_service_type |
Yes | Service type | "FOREXRATES" | Fixed value |
mobicard_token_id |
Yes | Unique token identifier | String/number | Must be unique per request |
mobicard_txn_reference |
Yes | Your transaction reference | String/number | Your internal reference |
mobicard_base_currency |
No | Base currency for rates (3-letter ISO code) | "USD" | Defaults to "USD" if not provided. Options: (USD, EUR, JPY, GBP, CNY). |
mobicard_query_currency |
No | Target currency (3-letter ISO code) | "EUR" or "" | Empty returns all currencies, specific code returns single rate |
Complete reference of all response parameters returned by the API.
The value for the "status" response parameter is always either "SUCCESS" or "FAILED". Use this to determine subsequent actions.
| Parameter | Always Returned | Description | Example Value |
|---|---|---|---|
status |
Yes | Transaction status | "SUCCESS" or "FAILED" |
status_code |
Yes | HTTP status code | "200" |
status_message |
Yes | Status description | "SUCCESS" |
mobicard_txn_reference |
Yes | Your original transaction reference | "694329793" |
mobicard_token_id |
Yes | Your unique API request id | "325026456" |
base_currency |
Yes | Base currency used for exchange rates. Options: (USD, EUR, JPY, GBP, CNY). | "USD" |
timestamp |
Yes | Response timestamp | "2026-01-29 16:31:01" |
forex_rates |
Yes | Object containing currency pair exchange rates | {"USDEUR": 0.835547, "USDUSD": 1} |
forex_rates.[CURRENCY_PAIR] |
Yes | Exchange rate for specific currency pair | 0.835547 (for USDEUR) |
forex_rates.USDUSD |
Yes | Always included with value 1 | 1 |
timestamp field to track rate freshnessA: Forex rates are updated in real-time from reliable financial data sources. The timestamp field indicates when the rates were last updated.
A: Yes, you can specify any supported 3-letter ISO currency code in the mobicard_base_currency parameter. Default is USD. Options: (USD, EUR, JPY, GBP, CNY).
A: The API supports 160+ global currencies including major, minor, and exotic currencies. The complete list is returned when querying without a specific currency.
A: Rates are sourced from reliable financial data providers and reflect real-time market conditions. Accuracy is suitable for commercial applications.
A: Yes, rate limits apply. If you exceed limits, you'll receive status code 429. Contact support for higher rate limits if needed for production use.
A: While rates are accurate, always verify with your financial institution for actual transaction rates, as spreads and fees may apply in real transactions.
A: During market closures, the API returns the last available rates with appropriate timestamp indication.