I need helping finding problem with my purchase code API call

envato-api

#1

I want to verify purchases using the purchase code.

I’m using the API call https://api.envato.com/v3/market/buyer/purchase?code={api-personal-token}

I get an error returned that reads:
[error] => Unauthorized operation - please use a valid token with the required permissions. Reason scope required purchase:verify [response_code] => 403

It appears my personal token is good but it doesn’t have the correct permission.
The permissions for that code are:
This token has access to:

    View and search Envato sites
    Verify purchases of your items

It looks correct to me.
The API doc for the command that I’m using is:
https://build.envato.com/api/#market_0_Buyer_Purchase

Strangely, the API docs doesn’t state what specific permission you need for each end point.
Does somebody know or have any idea what I have wrong?

Thanks.


#2

Hi @sclwp

I think you are using the wrong API method to validate a purchase code.
Here is an example of how to accomplish correctly this verification (click the link to view the code formatted):

All the best!


#3

@hevada is correct. /buyer/purchase is for verifying a purchase from a buyer perspective; you want /author/sale.


#4

Thank you