Currency Conversion
Introduction
The two types of dynamic currency conversion requests that can be used via the APIs are defined, similar to transactions, via the requestType
field:
DCCExchangeRateRequest
- Use 'Dynamic Currency Conversion' to select the optimal currency conversion and apply thatDynamicPricingExchangeRateRequest
- Request a listing of available exchange rates
Getting a DCC rate
The first step is to call the exchange-rates
endpoint with one of the above requestType
options.
// POST /exchange-rates
{
"requestType": "DCCExchangeRateRequest",
"baseAmount": "12.32",
"bin": "411111" // <-- the bin here tells us which currency is used
}
{
"clientRequestId": "30dd879c-ee2f-11db-8314-0800200c9a66",
"apiTraceId": "rrt-0bd552c12342d3448-b-ea-1142-12938318-7",
"requestTime": 1592912760,
"exchangeRateDetails": {
"inquiryRateId": 49150, // <-- reference for later use in the transaction
"foreignCurrency": "NOK",
"foreignAmount": 130.33,
"exchangeRate": 10.2968,
"dccOffered": "true",
"marginRatePercentage": "3",
// ...
}
}
// POST /exchange-rates
{
"requestType": "DynamicPricingExchangeRateRequest",
"baseAmount": "12.32",
"foreignCurrency": "USD"
}
Using the DCC rate
Using the inquiryRateId
provided in the response (see the above example), we can supply this in a transaction request to utilise the given exchange rate. The value must be provided in the currencyConversion
field object.
// POST /payments
{
"requestType": "PaymentCardSaleTransaction",
"transactionAmount": {
"total": "130.33",
"currency": "NOK"
},
"paymentMethod": {
"paymentCard": {
"number": "5424180279791732",
"securityCode": "977",
"expiryDate": {
"month": "12",
"year": "24"
}
}
},
"currencyConversion": {
"conversionType": "Dcc",
"inquiryRateId": "49150",
"dccApplied": true
}
}
Example complete!
If the
inquiryRateId
was supplied correctly and the resulting transaction was approved, this is now complete. Bear in mind that the giveninquiryRateId
is valid for TODO (add how long this is valid for).
Updated 3 months ago