Call the function below to change the electronic cash currency.
SCRIPT
function changeCurrency(d) {
_uz.api.contentWindow.postMessage({
action: "ecash-api-change-currency",
currency: d.currency
}, _uz.api.src);
};
Add post message listener to get the returned electronic cash currency.
SCRIPT
window.addEventListener("message", windowEvent);
windowEvent function (e) {
if (e.type.match(/(message)/)) try {
_uz.session = !_uz.session ? e.data.session : _uz.session;
if (e.data.action && e.data.action.match(/(ecash-api)/)) {
if (e.data.action && e.data.action.match(/(response)/)) {
if (data.action && data.action.match(/(read-account)/)) {
document.querySelector("selected-currency").value = data.account.currency;
};
};
};
} catch (error) {};
};
Add element to display the selected electronic cash currency.
HTML
<div id="selected-currency"></div>