[Envato API] - API purchase code authentication

Hey everyone,

I have a question about how to authenticate for the v1 purchase code API. For some background information, I’m trying to build into my service the ability to validate purchase codes.

I’m making a GET request to: http://marketplace.envato.com/api/edge/vital101/[API_KEY]:[PURCHASE_CODE].json but it keeps coming back with:

{
    "error": "Username and/or API Key invalid.",
    "code": "not_authenticated"
}

API_KEY is the personal key generated here (https://build.envato.com/create-token/). I don’t need the Oauth key because I don’t want the user to have to log in. I just need to validate that the purchase code is correct.

Since I’m getting the ‘not_authenticated’ error, I assume that my key is wrong. Any ideas?

I think you are missing the verify-purchase part.

http://marketplace.envato.com/api/edge/vital101/[API_KEY]/verify-purchase:[PURCHASE_CODE].json

I test it too… Same error.
Johnh10 do you try the code you write?

Works for me with my author name and my API key and a valid purchase code.

Ok, i will try it again! : -)

Your using V1 of the API right?
I think the API key you need is the one you can generate from your Envato Account Profile Settings - API Key.

This is a good point. The URL in the OP is marketplace.envato.com which is the old API which uses the API key generated in your Profile Settings.

But… vital also mentions hey made a token API KEY, which is the new API and uses the URL api.envato.com

So I just think vital just mixed the two up.

If you want to use the new API to make the call to verify a purchase, see https://build.envato.com/api/#market_0_Author_Sale

Note however the new API does require an OAuth key to request private information. :frowning:

So maybe I’m misunderstanding how the purchase code validation works. If I put in MY username, and MY api key, then I can validate purchase codes for MY products.

What I would like to do is validate purchase codes for other people. To do that, would I need their username and an API key?

What I would like to do is validate purchase codes for other people. To do that, would I need their username and an API key?

Yes, but I do not know if any other authors would want to hand over an API key for you. Why do you want to verify purchases for other authors out of curiosity?

I’m creating a private Wordpress plugin/theme update service (https://kernl.us). I want users to automagically be able to validate purchase codes from plugins during the process.

So the process would be like:

  • user requests plugin/theme update.
  • server checks the user’s purchase code against envato.
  • returns proper update response if valid.
  • returns 401 or something otherwise.

Hello friends
After entering the username and API and save changes to the WordPress theme did not show any particular message, the field guide me?
image

Ho John,

Can you provide me personal token and working purchase code I want to test in my plugin.