From f0e8ae0f5cf181fd901d747ca9bb9eecdfeb6b79 Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Fri, 19 Dec 2025 07:23:56 +0000 Subject: [PATCH] Adds support for stripe readers (#3678) --- lnbits/fiat/stripe.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lnbits/fiat/stripe.py b/lnbits/fiat/stripe.py index 10eda4e4..d5a0c95c 100644 --- a/lnbits/fiat/stripe.py +++ b/lnbits/fiat/stripe.py @@ -35,6 +35,7 @@ class StripeTerminalOptions(BaseModel): capture_method: Literal["automatic", "manual"] = "automatic" metadata: dict[str, str] = Field(default_factory=dict) + reader_id: str | None = None class StripeCheckoutOptions(BaseModel): @@ -295,6 +296,15 @@ class StripeWallet(FiatProvider): r.raise_for_status() return r.json() + async def _process_terminal_payment_intent( + self, reader_id: str, payment_intent_id: str + ) -> None: + data = {"payment_intent": payment_intent_id} + r = await self.client.post( + f"/v1/terminal/readers/{reader_id}/process_payment_intent", data=data + ) + r.raise_for_status() + async def _create_checkout_invoice( self, amount_cents: int, @@ -378,6 +388,17 @@ class StripeWallet(FiatProvider): ok=False, error_message="Error: missing PaymentIntent or client_secret", ) + if term.reader_id: + try: + await self._process_terminal_payment_intent(term.reader_id, pi_id) + except Exception as exc: + logger.warning(exc) + return FiatInvoiceResponse( + ok=False, + error_message=( + "Error: unable to process PaymentIntent on reader" + ), + ) return FiatInvoiceResponse( ok=True, checking_id=pi_id, payment_request=client_secret )