diff --git a/payments/payment_gateways/doctype/braintree_settings/braintree_settings.py b/payments/payment_gateways/doctype/braintree_settings/braintree_settings.py index 6f694a90..5600acbd 100644 --- a/payments/payment_gateways/doctype/braintree_settings/braintree_settings.py +++ b/payments/payment_gateways/doctype/braintree_settings/braintree_settings.py @@ -267,10 +267,12 @@ def create_charge_on_braintree(self): ) else: status = "Error" - redirect_url = "payment-failed" + redirect_url = ( + f"payment-failed?doctype={self.data.reference_doctype}&docname={self.data.reference_docname}" + ) if redirect_to: - redirect_url += "?" + urlencode({"redirect_to": redirect_to}) + redirect_url += "&" + urlencode({"redirect_to": redirect_to}) if redirect_message: redirect_url += "&" + urlencode({"redirect_message": redirect_message})