如何通过php查看Google Play的IAP购买?

I am developing an android app and implemented IAP purchases. My goal currently is to prevent IAP crackers from stealing digital content.

To do this I obviously need to confirm the purchase on my server with googles server.

How can I do this? What I need is something like this:

<?PHP

$success = false; //Assume until certain

$base64key = "example";
$originalJson = $_GET["originalJson"];
$purchaeSignature = $_GET["signature"];

//Verify - This is the step I would like a snippet for.

echo json_encode($success === true ? "success" : "failed");
?>

I have seen a similar thread to this on StackOverflow but it did not help me much and still left me a few questions.