Ok I figured it out by first printing the raw post data before doing the JSON decode. Turns out my PHP installation has magic quotes enabled, and automatically put escape slashes before every quote in the JSON payload. Obviously, this made the JSON invalid, and JSON_decode errored-out as a result.
Here is the simple fix:
$payload = json_decode(stripslashes($_REQUEST['payload']));