diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 894b4a44..553e1b90 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -324,12 +324,14 @@ async def api_payments_sse( @core_app.get("/api/v1/payments/{payment_hash}") async def api_payment(payment_hash): - payment = await get_standalone_payment(payment_hash) await check_invoice_status(payment.wallet_id, payment_hash) payment = await get_standalone_payment(payment_hash) if not payment: - return {"message": "Payment does not exist."} + raise HTTPException( + status_code=HTTPStatus.NOT_FOUND, + detail="Payment does not exist.", + ) elif not payment.pending: return {"paid": True, "preimage": payment.preimage} diff --git a/lnbits/wallets/lnbits.py b/lnbits/wallets/lnbits.py index 6a1bd02b..70d7b141 100644 --- a/lnbits/wallets/lnbits.py +++ b/lnbits/wallets/lnbits.py @@ -45,7 +45,7 @@ class LNbitsWallet(Wallet): ) if r.is_error: - return StatusResponse(data["message"], 0) + return StatusResponse(data["detail"], 0) return StatusResponse(None, data["balance"]) @@ -73,7 +73,7 @@ class LNbitsWallet(Wallet): ) if r.is_error: - error_message = r.json()["message"] + error_message = r.json()["detail"] else: data = r.json() checking_id, payment_request = data["checking_id"], data["payment_request"] @@ -90,7 +90,7 @@ class LNbitsWallet(Wallet): ok, checking_id, fee_msat, error_message = not r.is_error, None, 0, None if r.is_error: - error_message = r.json()["message"] + error_message = r.json()["detail"] else: data = r.json() checking_id = data["checking_id"]