Yeah, looks like you forgot to authenticate your API request with a personal token. You need to add the Authorization
and User-Agent
headers per the post linked by @mgscoder:
$header = array();
$header[] = 'Content-length: 0';
$header[] = 'Content-type: application/json; charset=utf-8';
$header[] = 'Authorization: Bearer PERSONAL_TOKEN_HERE';
$header[] = 'User-Agent: Purchase code verification on mywebsite.com';
Here is a fully working code sample for verifying purchase codes, if you want to reference it: