New API - support verification question

Hi there, I’m updating my support platform, but stuck on an empty value returned.
Using this endpoint: http://marketplace.envato.com/api/edge/USERNAME/API-KEY/verify-purchase:PURCHASE-CODE.json

I get this answer

[item_name] => Media Grid - Wordpress Responsive Portfolio
[item_id] => 2218545
[created_at] => Tue Mar 11 08:36:09 +1100 2014
[buyer] => mtmfx
[licence] => Regular License
[supported_until] => 

From what I read in the official envato post, the supported_until parameter should have a date or NULL value.

What am I missing?

supported_until will be empty until sep 1st.

Also it’s best to use the new API endpoint which is https://api.envato.com/v1/market/private/user/verify-purchase:PURCHASECODEHERE.json because that old API will be switched off at some point in the future.

1 Like

I do hope they announce the date the old API will be deactivated, well in advance of it being so…

1 Like

Thanks buddy @dtbaker! :wink:

Sorry to bug you again @dtbaker but I’m still not understanding why I get “Wrong authorization header” on my cURL call.

Here’s the code I’m using (personal token):

  $ch = curl_init(); 
  $url = 'https://api.envato.com/v1/market/private/user/verify-purchase:'.$pur_code.'.json';

   $headers = array(
         'Content-length: 0',
         'Content-type: application/json',
         'Authorization: bearer'. get_option('et_envato_pers_token')
    );
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);    

    curl_setopt($ch, CURLOPT_USERAGENT, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    
    $data = curl_exec($ch);
    curl_close($ch);

What am I missing? (part II)

Maybe try:

$ch = curl_init();
$url = 'https://api.envato.com/v1/market/private/user/verify-purchase:'.$pur_code.'.json';
$headers = array(
    'Authorization: bearer'. get_option('et_envato_pers_token')
);
echo "Header are: 
"; print_r($headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_USERAGENT, "My Cool App"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_MAXREDIRS, 3); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); $data = curl_exec($ch); curl_close($ch);

uhm…now it works. Strange, since before I also used just one array element for bearer.
Maybe was just the

curl_setopt($ch, CURLOPT_USERAGENT, "App name");

value.

Thanks #2, I owe you a pizza :stuck_out_tongue:

1 Like

Yep looks like they need a valid user agent. Good luck with it!

New doubt (and I suppose the one and only @dtbaker knows the solution :smiley:)
Is the 1° september, but API still returns an empty field for “supported until”.

Do I have to create a script to calculate 6 months from today…??

I’m calculating 6 months from today for all purchases that occured before today.

API isn’t returning correct data. Hopefully they fix it soon :slight_smile:

Hopefully they do all that calculation for us and we can just rely on this value, but for now just calculate on the purchase date.

Some other discussions on this was here: Item Support Policy and Functionality Launched

Wow, a bug. Strange thing from Envato lately…!
Yes, I’ll pose the same question on the main thread. Thanks :wink: