From d99275b31f1b2a42ad8aeb2744418d00a34eb511 Mon Sep 17 00:00:00 2001 From: Christian Wach Date: Mon, 16 Nov 2020 19:20:49 +0000 Subject: [PATCH] Prevent PayPal from double-encoding the IPN Notify URL --- CRM/Core/Payment/PayPalImpl.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index e2f8cb7596..57dd8cc633 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -976,6 +976,14 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { // Allow further manipulation of the arguments via custom hooks .. CRM_Utils_Hook::alterPaymentProcessorParams($this, $params, $paypalParams); + /* + * PayPal urlencodes the IPN Notify URL. For sites not using Clean URLs (or + * using Shortcodes in WordPress) this results in "%2F" becoming "%252F" and + * therefore incomplete transactions. We need to prevent that. + * @see https://lab.civicrm.org/dev/core/-/issues/1931 + */ + $paypalParams['notify_url'] = rawurldecode($paypalParams['notify_url']); + $uri = ''; foreach ($paypalParams as $key => $value) { if ($value === NULL) { -- 2.25.1