diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs index 2ac3f26bd..04cffaa55 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs @@ -55,18 +55,23 @@ namespace BTCPayServer.Payments.Bitcoin model.IsLightning = false; model.PaymentMethodName = GetPaymentMethodName(network); - var invoiceBitcoinUrl = cryptoInfo.PaymentUrls.BIP21; + var lightningFallback = ""; if (storeBlob.OnChainWithLnInvoiceFallback) { var lightningInfo = invoiceResponse.CryptoInfo.FirstOrDefault(a => a.GetpaymentMethodId() == new PaymentMethodId(model.CryptoCode, PaymentTypes.LightningLike)); if (!String.IsNullOrEmpty(lightningInfo?.PaymentUrls?.BOLT11)) - invoiceBitcoinUrl += "&" + lightningInfo.PaymentUrls.BOLT11.Replace("lightning:", "lightning=", StringComparison.OrdinalIgnoreCase); + lightningFallback = "&" + lightningInfo.PaymentUrls.BOLT11.Replace("lightning:", "lightning=", StringComparison.OrdinalIgnoreCase); } - model.InvoiceBitcoinUrl = invoiceBitcoinUrl; - model.InvoiceBitcoinUrlQR = invoiceBitcoinUrl; + model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BIP21 + lightningFallback; + // We're trying to make as many characters uppercase to make QR smaller + // Ref: https://github.com/btcpayserver/btcpayserver/pull/2060#issuecomment-723828348 + model.InvoiceBitcoinUrlQR = cryptoInfo.PaymentUrls.BIP21 + // .Replace("bitcoin:", "BITCOIN:", StringComparison.OrdinalIgnoreCase) + + lightningFallback.ToUpperInvariant().Replace("LIGHTNING=", "lightning=", StringComparison.OrdinalIgnoreCase); + ; } public override string GetCryptoImage(PaymentMethodId paymentMethodId)