632 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes says

Hi, guys…

I know the question about getting the verification code from the envato api has been raised a few times recently.

But i was wondering if anyone who has implemented this can tell me if this is about spot on or if it will throw errors.

I cant test it because i have no verification codes for my own items.

Here is the code:

$myusername = 'MY PERSONAL USERNAME FROM ENVATO';
        $myapi = 'MY API KEY FROM ENVATO';

        $apiurl = 'http://marketplace.envato.com/api/edge/' . $myusername . '/' . $myapi . '/verify-purchase:' . $verification . '.json';

        $cinit = curl_init($apiurl);
        curl_setopt($cinit, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($cinit, CURLOPT_RETURNTRANSFER, true);
        $cinit_data = curl_exec($cinit);
        curl_close($cinit);

        $verification_data = json_decode($cinit_data, true);

        if(empty($verification_data['verify-purchase'])){
            $errors[] = 'Sorry your verification code is not correct, we can not support you with out the relevant information!';
        } else { // do something
}

When running the code it comes back with the error variable which was expected as i do not have the purchase verification code.

I can not see if it comes back true if there is a verification code though.

3091 posts
  • Located in Australia
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
  • Helped several times protecting Envato Market against copyright violations
+16 more
dtbaker Volunteer moderator says

yer should be right, just put some debugging in there eg:

mail('you@example.com','Verify purchase debugging!',$verification."\n".var_export($verification_data,true));

then when you get a real user you will get their code and see if it works or not.

632 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes says

yer should be right, just put some debugging in there eg:
mail('you@example.com','Verify purchase debugging!',$verification."\n".var_export($verification_data,true));
then when you get a real user you will get their code and see if it works or not.

Thanks for the reply, most appreciated :)

by
by
by
by
by
by