Foreign exchange rate
API reference
Retrieves the foreign exchange rate for the desired currency from USD or to USD, determined by use of fromAmount or toAmount.
Endpoint: /cardpayments/v1/fxrates
GET
https://sandbox.crbcos.com/cardpayments/v1/fxrates
Query Parameters
- currencystringrequiredDescription
- fromAmountintegerDescription
- toAmountintegerDescription
Response
- fxRatesNetworkResponsesobjectDescription
- networkstringDescription
- currencystring
- fromAmountintegerDescription
- toAmountintegerDescription
- exchangeRatestringDescription
curl
curl --location 'https://sandbox.crbcos.com/cardpayments/v1/fxrates?currency=EUR&fromAmount=100' \
--header 'Authorization: Bearer <token>' \
--header 'Accept: application/json'nodejs
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': 'sandbox.crbcos.com',
'path': '/cardpayments/v1/fxrates?currency=EUR&fromAmount=100',
'headers': {
'Authorization': 'Bearer <token>',
'Accept': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();python
import requests
url = "https://sandbox.crbcos.com/cardpayments/v1/fxrates?currency=EUR&fromAmount=100"
payload = {}
headers = {
'Authorization': 'Bearer <token>',
'Accept': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "net/http"
url = URI("https://sandbox.crbcos.com/cardpayments/v1/fxrates?currency=EUR&fromAmount=100")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <token>"
request["Accept"] = "application/json"
response = https.request(request)
puts response.read_body
go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.crbcos.com/cardpayments/v1/fxrates?currency=EUR&fromAmount=100"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Accept", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}200
{
"fxRatesNetworkResponses": [
{
"network": "Mastercard",
"currency": "eur",
"fromAmount": 100,
"toAmount": 85,
"exchangeRate": "0.853243"
},
{
"network": "Visa",
"currency": "eur",
"fromAmount": 100,
"toAmount": 91,
"exchangeRate": "0.913242"
}
]
}