- United Kingdom
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
- Most Wanted Bounty Winner
- Interviewed on the Envato Notes blog
- Referred between 10 and 49 users
- Bought between 10 and 49 items
- Microlancer Beta Tester
- Has been a member for 1-2 years
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.
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
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.
- United Kingdom
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
- Most Wanted Bounty Winner
- Interviewed on the Envato Notes blog
- Referred between 10 and 49 users
- Bought between 10 and 49 items
- Microlancer Beta Tester
- Has been a member for 1-2 years
dtbaker said
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 
