How do I resolve API timeout problems?
To resolve API timeout concerns, it will be necessary to determine if the problem is in the API call or if there is an issue with the endpoint being called.
Here's how to troubleshoot timeout issues:
- Check for issues – Visit the PayPal status page to check for current issues affecting performance.
- Check firewalls – Check for any firewalls or other access controls that might prevent your application from connecting to our servers.
- Check your code's timeout configuration – We recommend a minimum timeout setting of 30 seconds, even though API requests are expected to process in a much shorter time. This adds more flexibility in situations where a response is delayed. If the timeout interval is set to a lower value, increase it to 30 seconds.
- Run nslookup – Run nslookup (or the dig or host commands if nslookup is unavailable) on the API URL to which your application points and note the IP addresses returned.
- Compare the returned addresses to the IP addresses listed for our servers.
- If the returned URL IP address doesn't match with one of our servers, investigate further (check DNS, host files, and so on).
- Refresh the DNS cache – For Java-based integrations, you may have to refresh the DNS cache if an IP address for an API URL has changed. Typically, this requires restarting the JVM/application server (JBoss, GlassFish, etc.). You can learn more about Java-based applications by researching the java.net.InetAddress class and the networkaddress.cache.ttl property.
- Run the traceroute command – Run the traceroute command from your server or your proxy server (if you use one) to our API endpoint. Then, run the same command from a location that can access PayPal (ideally, one outside your network) and compare the results. If the traceroute stops after a hop between our API endpoint and your server, one of the hops along the route is probably blocking the request.
- Use OpenSSL – Use OpenSSL to verify connectivity with our API endpoints or other IP addresses. For example, issue this command: openssl s_client -connect api-3t.paypal.com:443.
- If this command connects successfully, you'll see "CONNECTED" in the first line of the response.
- If OpenSSL isn't currently installed on your operating system, go to www.openssl.org to download the binaries.
Warning: Don't use Telnet under any circumstances to verify connectivity to PayPal API endpoints or other IP addresses. Because Telnet is not SSL-aware and doesn't follow up with an SSL handshake, this may trigger a temporary blacklist on the PayPal site, further complicating troubleshooting.
- Determine which servers are affected – For applications running on multiple servers, you can try to determine if the timeouts occur for requests that originate from one server or if they happen across all servers.
- If timeouts occur for only one server, run nslookup (or the "dig" or "host" commands if nslookup is unavailable) from the problem server and again from any servers that seem unaffected, then compare the results.
- If the problem server shows different IP addresses for the same URL, you might be able to resolve the issue by restarting the server.
See the Developer Portal for a complete list of NVP/SOAP API error codes.