diff --git a/BTCPayServer/wwwroot/paybutton/paybutton.js b/BTCPayServer/wwwroot/paybutton/paybutton.js index 1c9055700..6f6a9adf1 100644 --- a/BTCPayServer/wwwroot/paybutton/paybutton.js +++ b/BTCPayServer/wwwroot/paybutton/paybutton.js @@ -224,8 +224,17 @@ function addInputPrice(name, price, widthInput, customFn, type, min, max, step) } function addSelectCurrency(currency) { + // Remove all non-alphabet characters from input string and uppercase it for display + var safeCurrency = currency.replace(/[^a-z]/gi, '').toUpperCase(); + var defaultCurrencies = ['USD', 'GBP', 'EUR', 'BTC']; + var options = defaultCurrencies.map(c => ' '); + // If user provided a currency not in our default currencies list, add it to the top of the options as a selected option + if (defaultCurrencies.indexOf(safeCurrency) === -1) { + options.unshift(' ') + } + return ' \n' }