diff --git a/lnbits/core/templates/core/_api_docs.html b/lnbits/core/templates/core/_api_docs.html
index c7f3f9ade..0e74f38e4 100644
--- a/lnbits/core/templates/core/_api_docs.html
+++ b/lnbits/core/templates/core/_api_docs.html
@@ -61,7 +61,7 @@
curl -X POST {{ request.base_url }}api/v1/payments -d '{"out": false,
"amount": <int>, "memo": <string>, "webhook":
- <url:string>}' -H "X-Api-Key: {{ wallet.inkey }}" -H
+ <url:string>, "unit": <string>}' -H "X-Api-Key: {{ wallet.inkey }}" -H
"Content-type: application/json"
diff --git a/lnbits/core/templates/core/wallet.html b/lnbits/core/templates/core/wallet.html
index 2b6ec5dec..95436f860 100644
--- a/lnbits/core/templates/core/wallet.html
+++ b/lnbits/core/templates/core/wallet.html
@@ -417,9 +417,11 @@
filled
dense
v-model.number="receive.data.amount"
- type="number"
- label="Amount ({{LNBITS_DENOMINATION}}) *"
- :step="receive.unit != 'sat' ? '0.001' : '1'"
+ :label="'Amount (' + receive.unit + ') *'"
+ :mask="receive.unit != 'sat' ? '#.##' : '#'"
+ fill-mask="0"
+ reverse-fill-mask
+ :step="receive.unit != 'sat' ? '0.01' : '1'"
:min="receive.minMax[0]"
:max="receive.minMax[1]"
:readonly="receive.lnurl && receive.lnurl.fixed"
@@ -437,7 +439,7 @@
diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py
index 107a26846..d607e1492 100644
--- a/lnbits/core/views/api.py
+++ b/lnbits/core/views/api.py
@@ -31,6 +31,7 @@ from lnbits.utils.exchange_rates import (
fiat_amount_as_satoshis,
satoshis_amount_as_fiat,
)
+from lnbits.settings import LNBITS_SITE_TITLE
from .. import core_app, db
from ..crud import (
@@ -123,7 +124,7 @@ async def api_payments(wallet: WalletTypeInfo = Depends(get_key_type)):
class CreateInvoiceData(BaseModel):
out: Optional[bool] = True
- amount: int = Query(None, ge=1)
+ amount: float = Query(None, ge=0)
memo: str = None
unit: Optional[str] = "sat"
description_hash: Optional[str] = None
@@ -140,9 +141,9 @@ async def api_payments_create_invoice(data: CreateInvoiceData, wallet: Wallet):
memo = ""
else:
description_hash = b""
- memo = data.memo
+ memo = data.memo or LNBITS_SITE_TITLE
if data.unit == "sat":
- amount = data.amount
+ amount = int(data.amount)
else:
price_in_sats = await fiat_amount_as_satoshis(data.amount, data.unit)
amount = price_in_sats
@@ -292,11 +293,11 @@ async def api_payments_pay_lnurl(
detail=f"{domain} returned an invalid invoice. Expected {data.amount} msat, got {invoice.amount_msat}.",
)
- # if invoice.description_hash != data.description_hash:
- # raise HTTPException(
- # status_code=HTTPStatus.BAD_REQUEST,
- # detail=f"{domain} returned an invalid invoice. Expected description_hash == {data.description_hash}, got {invoice.description_hash}.",
- # )
+ # if invoice.description_hash != data.description_hash:
+ # raise HTTPException(
+ # status_code=HTTPStatus.BAD_REQUEST,
+ # detail=f"{domain} returned an invalid invoice. Expected description_hash == {data.description_hash}, got {invoice.description_hash}.",
+ # )
extra = {}