From 2afe9f7ced6ecab99554c596e9e68889b7eeed48 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 23 Sep 2025 15:24:48 +0200 Subject: [PATCH] Issue-148-stripe-checkout-amount-fix --- payments/templates/pages/stripe_checkout.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/payments/templates/pages/stripe_checkout.py b/payments/templates/pages/stripe_checkout.py index 7f4a30e0..715f7ade 100644 --- a/payments/templates/pages/stripe_checkout.py +++ b/payments/templates/pages/stripe_checkout.py @@ -39,6 +39,20 @@ def get_context(context): context.image = get_header_image(context.reference_docname, gateway_controller) context["amount"] = fmt_money(amount=context["amount"], currency=context["currency"]) + + try: + reference = frappe.get_doc(context.reference_doctype, context.reference_docname) + context["amount"] = fmt_money(amount=reference.grand_total, currency=reference.currency) + except: + frappe.log_error( + "Grant Total not found in {}," "For document {}".format(context.reference_doctype, context.reference_docname) + ) + frappe.redirect_to_message( + _("Amount and currency could not be determined"), + _("Looks like someone sent you to an incomplete URL. Please ask them to look into it."), + ) + frappe.local.flags.redirect_location = frappe.local.response.location + raise frappe.Redirect if is_a_subscription(context.reference_doctype, context.reference_docname): payment_plan = frappe.db.get_value(