One of the worst activities for a developer is to debug integration with badly designed web APIs, read: to debug Paypal integration.
It’s a “what you don’t know that you don’t know” kind of problem. Even reading the docs, you end up needing to deduce how things work by looking at actual data.
In this scenario, it’s useful to just set a breakpoint and follow the code execution to explore and learn.
For this you need to interact with the online system’s sandbox, in my case, Paypal’s sandbox must be able to reach my development instance.
There are many ways to achieve this. The most commons are:
- Running your development code from an online server.
- Expose your local instance through a ssh reverse tunnel.
The really easy and effortlessly way is to do it is using Ngrok.
Ngrok is the answer for the question:
“How can I securely expose a local web server to the internet and capture all traffic for detailed inspection and replay.”
It’s an online service that not only enables you to expose your localhost to the internet, but also records the network traffic so you can tinker with it and replay the requests. Simply amazing!
With Ngrok I’ve quickly discovered that Paypal IPN Simulator suggests a default
payment_date value on a different format from what we get in production.
Damn you Paypal. Thank you Ngrok!