diff --git a/BTCPayServer/Controllers/InvoiceController.cs b/BTCPayServer/Controllers/InvoiceController.cs index 642e7080e..b07e67e2b 100644 --- a/BTCPayServer/Controllers/InvoiceController.cs +++ b/BTCPayServer/Controllers/InvoiceController.cs @@ -98,8 +98,7 @@ namespace BTCPayServer.Controllers { throw new BitpayHttpException(400, "The expirationTime is set too soon"); } - invoice.Currency = invoice.Currency?.ToUpperInvariant() ?? "USD"; - entity.Currency = invoice.Currency; + invoice.Currency = invoice.Currency?.Trim().ToUpperInvariant() ?? "USD"; entity.Metadata.OrderId = invoice.OrderId; entity.Metadata.PosData = invoice.PosData; entity.ServerUrl = serverUrl; @@ -169,6 +168,7 @@ namespace BTCPayServer.Controllers if (invoice.Metadata != null) entity.Metadata = InvoiceMetadata.FromJObject(invoice.Metadata); invoice.Checkout ??= new CreateInvoiceRequest.CheckoutOptions(); + invoice.Currency = invoice.Currency?.Trim().ToUpperInvariant() ?? "USD"; entity.Currency = invoice.Currency; entity.Price = invoice.Amount; entity.SpeedPolicy = invoice.Checkout.SpeedPolicy ?? store.SpeedPolicy; diff --git a/BTCPayServer/Services/Invoices/InvoiceEntity.cs b/BTCPayServer/Services/Invoices/InvoiceEntity.cs index 6df2cdaf7..e3b41b95c 100644 --- a/BTCPayServer/Services/Invoices/InvoiceEntity.cs +++ b/BTCPayServer/Services/Invoices/InvoiceEntity.cs @@ -569,7 +569,7 @@ namespace BTCPayServer.Services.Invoices wellknown.OrderId = val2.Value(); } Metadata = wellknown; - Currency = productInformation.Currency; + Currency = productInformation.Currency?.Trim().ToUpperInvariant(); Price = productInformation.Price; } else