From 216f931993f4cba7ed21d2953c8866afdea5cdef Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 25 Oct 2023 13:24:34 +0200 Subject: [PATCH] Stripe: Guard against invalid JSON in API --- src/pretix/plugins/stripe/payment.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pretix/plugins/stripe/payment.py b/src/pretix/plugins/stripe/payment.py index 8fa14b7530..60b6d26aba 100644 --- a/src/pretix/plugins/stripe/payment.py +++ b/src/pretix/plugins/stripe/payment.py @@ -39,6 +39,7 @@ import re import urllib.parse from collections import OrderedDict from decimal import Decimal +from json import JSONDecodeError import stripe from django import forms @@ -675,9 +676,12 @@ class StripeMethod(BasePaymentProvider): } def api_refund_details(self, refund: OrderRefund): - return { - "id": refund.info_data.get("id", None), - } + try: + return { + "id": refund.info_data.get("id", None), + } + except JSONDecodeError: + return {} def payment_control_render(self, request, payment) -> str: if payment.info: