django-paypal
django-paypal copied to clipboard
doDirectPayment(self, params) urlencoding params vs NVP documentation (and real world testing)
helpers.py:306 pp_string = self.signature + urlencode(pp_params)
urlencodes all pp_params, including the notifyurl, but the PayPal NVP developer documentation does not state the NOTIFYURL needs to be urlencoded.
NOTIFYURL (Optional) Your URL for receiving Instant Payment Notification (IPN) about this transaction. If you do not specify this value in the request, the notification URL from your Merchant Profile is used, if one exists.
Looking at my IPN History there are many IPNs that have failed and are Retrying
Notification URL: https%3A%2F%2Fb2796cd28232.ngrok.app%2Fpaypal%2F HTTP response code: 500 Delivery status: Retrying No. of retries: 7
The IPN history Notification URL is urlencoded and I suspect PayPal does not decode the URL and that is why it is failing.
Using curl which does not urlencode the POST params works as expected.
Things changed at PayPal around Sep 30, 2024.
Before Sep 30, 2024 the urlencoded params worked as expected /and/ curl worked as expected.
I cannot find any documentation about the change.
I cannot find confirmation that params need to be urlencoded.
My work-around has been to remove the NOTIFYURL from the params and set the IPN NOTIFYURL in the PayPal Manager. Not an ideal situation.
I can make the changes to helpers.py but I would like confirmation that what I am seeing before making a PR.