When we try to contact the PayPal Adaptive Payments endpoint, both at: https://svcs.paypal.com/AdaptivePayments/Pay (for explicit chained payments) https://svcs.paypal.com/AdaptivePayments/Preapproval (for preapproved payments)
since the second half of July we get a very slow response from paypal, more than 50 sec. After the response arrives everything is ok but we're investigating on this odd time response because it brings to a lot of cart drop for our users.
Firstly we've checked our SOAP call to the endpoint and our request envelope and everything (that always worked in the past 6 years) seems ok. We've just added a 'compression' => SOAP_COMPRESSION_ACCEPT, line in the soap client request because it seems to be required now (we never used it before but we got a unknown content encoding error since july without this line). Anyway, the slow response was present even before this patch and starting from the beginning / second half of July.
We've then tested if we had some corrupted tables in the database but everything is ok.
Then we've checked deeply what we do between the request to paypal endpoint and the response but we do absolutely nothing else than opening the call and waiting the response.
We first define our headers then we make the call:
$soapClient = new SoapClient($this->wsdl,
array('location' => $this->EndPointURL."AdaptivePayments/Preapproval/",
'uri' => "urn:Preapproval",
'soap_version' => SOAP_1_1,
'trace' => 1, //debugging option
'compression' => SOAP_COMPRESSION_ACCEPT,
'stream_context' => $ctx)); //adding the stream context option containing the http headers
$response = objectToArray($soapClient->Preapproval($params));
} catch (SoapFault $e) {
$response = objectToArray($e);
}
return $response;
}
the thing is very similar for the Pay operation where we have too the same 50-52 seconds delay in the paypal response.
In a normal behaviour we do expect a response between 1-5 seconds. We think this is an issue on paypal servers and we're waiting an answer from the MTS but any suggestion in the meanwhile is welcome.
After weeks of troubleshooting and countless attempts to get any advice from the PayPal MTS (without having any useful one), we finally figured out what was really happening and how to fix it (not a quick and easy fix), I'm going to post this solution for the few who might fall in the same time response issue on the soap request to adaptive payments API endopoint.
First, we worked to check that there was no issues at all on our hand due to firwalls, networking problems or coding, we performed a lot of test (but real) orders in the production (live) environment, both using the Pay operation of the adaptive payments API for chained payments and the Preapproval operation and we stated that the 49 seconds time response from any of the svcs endpoint connection attempts we were doing was due to something on the PayPal server configuration, something (that we can't know) specifically regarding the SOAP connection (nothing regarding the subsequent data envelope).
We've so rewritten a big part of our code switching from a SOAP connection to a cURL connection and everything started working again with good time response in order of 1-3 seconds, absolutely acceptable again.
All of this in production environment and, unfortunately, everything without any advice from the PayPal status websites or notifications to mechants and app developers, nor from the MTS Team.
So, the final advice for the PayPal Tech Team is that there's something that has changed on PayPal adaptive payments svcs endpoint server configuration that approximatively from July 2019 between 10 and 20 July (unfortunately we can't state the precise day) stopped to give quick responses to SOAP requests and started fiving very long response (always 49-51 secs).
Changing the whole code to open the connection and transfer data via cURL instead than via SOAP we've solved the problem but this was a tech adventure because no-one gave us any advice on this. And this is a pity.
Hope this can be useful for someone, were nightmare weeks for us.
Cheers, Fil.