2280 posts
  • Top Monthly Author
  • Weekly Top Seller
  • Community Superstar
  • Industrious API Inventor
+16 more

you have to explain them how to obtain the purchase code as well and the value is different for each purchase. On the other hand, the api key only has to be generated once and then it works for any theme.

I also assume the purchase verify is done on the update server or else it would be possible to bypass the check and obtain a download link without a purchase code. Even by caching the result, there’s still the possibility to hit the api limit.


Since most buyers only purchase one item this doesn’t matter imo. If they purchase more than one each theme offers a different way to enter the credentials so it’s still confusing.

Purchase code is like a license key for software which is more common. Many do not even know what an API is.

Also the lack of support of WP plugins demands for a custom solution. I can also limit the amount of domains the plugin is used (regular license) which isn’t possible with the “native” method.

501 posts
  • Affiliate Level 7
  • Author Level 10
  • Collector Level 2
  • Top Monthly Author
+10 more

Also the lack of support of WP plugins demands for a custom solution. I can also limit the amount of domains the plugin is used (regular license) which isn’t possible with the “native” method.
I can understand the choice for plugins because currently there’s no other way to give buyers auto updates.

It would be much simpler if envato would just do for plugins what they did for themes. This would allow buyers to just configure their api key once per installation and being able to update all items purchased from TF/CC at once in the same way as they do for theme/plugins installed from wp.org

About the domain check, that’s really another subject.


4 posts
  • Collector Level 3
  • Exclusive Author
  • 6 Years of Membership
  • United Kingdom

On every new download, after the users install a script, is there a way to “activate it” for the first time by entering a purchase id that will be confirmed with envato and if it will fails the script wont unlock?

202 posts Quality Templates
  • Trendsetter
  • Elite Author
  • Author Level 8
  • Exclusive Author
+4 more

Seems problem in first code example failed to open stream: HTTP request failed! HTTP/1.1 422 Unprocessable Entity

59 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
  • 4 Years of Membership
+1 more

Basing of all your previous code, and on fact that envato security now require API requests to have user-agent set – I’ve made this class and simple method that seems to work.

class Envato {

    public static function verifyPurchase($userName, $apiKey , $purchaseCode, $itemId = false) {

        // Open cURL channel
        $ch = curl_init();

        // Set cURL options
        curl_setopt($ch, CURLOPT_URL, "http://marketplace.envato.com/api/edge/$userName/$apiKey/verify-purchase:$purchaseCode.json");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_USERAGENT, 'ENVATO-PURCHASE-VERIFY'); //api requires any user agent to be set

        // Decode returned JSON
        $result = json_decode( curl_exec($ch) , true );

        //check if purchase code is correct
        if ( !empty($result['verify-purchase']['item_id']) && $result['verify-purchase']['item_id'] ) {
            //if no item name is given - any valid purchase code will work
            if ( !$itemId ) return true;
            //else - also check if purchased item is given item to check
            return $result['verify-purchase']['item_id'] == $itemId;

        //invalid purchase code
        return false;


1 post
  • 2 Years of Membership
  • Affiliate Level 2
  • India


A lot of users may use this one to check is envato user purchased my item or not.

I decided to make a domain that checks a purchase using the Envato API , your username, your api key, and the customers “Item Purchase Code” ( they can get this from the license file ) .

Here is the domain. Please test it and tell me if it works well, and also use it as you like in your support.

URL: http://envato-verify-purchase.buy-themes.in/