647 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.

3263 posts
  • 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
  • Won a competition
+15 more
dtbaker 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.

647 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 :)

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by