How to verify purchase using Purchase Code using new API

I am an Android Developer.
I tried a lot but didn’t found any way to verify purchase using the new API. I can’t ask users to log in because it will be useless in Java projects.
I want users to enter the purchase code, then it will be compiled. After that, the app will check if the Purchase code is valid or not. If not then don’t stop there.
I already saw this post but it will not work in my case Verify Purchase API Response Example

You can’t do this, you must provide your full source code and compiled app without any purchase verification. They’re working on a help article to explain this, but in the meantime you can look at this rejection message.


I do not think you can make the compiler to first ask code that is against the Envato rules, but it also against any idea on how things work.
Compiler can not work by connecting to an API first, except if you make an online generator of your code

1 Like

@baileyherbert I am giving the full source code to the buyers. All I want them is to paste in their purchase code inside my application and compile it. Then the app will check the purchase code and then decide what to do next.
Hope you get it @creativeGagency

You’ll need your own server to do the verification, otherwise it’s insecure. You can verify a purchase code at this URL:

  • You should pass an Authorization header like this: Authorization: Bearer <token>

  • You can retrieve your <token> at (make sure you make a Personal token app, at the very bottom of the page, and give it “Verify purchases of your items” permission).

Example response for a valid purchase code (HTTP 200 OK):

  "amount": "16.00",
  "sold_at": "2016-08-09T10:13:26+10:00",
  "item": {
    "id": 17022701,
    "name": "Item name...",
    "description": "Item description in HTML form...",
    "site": "",
    "classification": "php-scripts/project-management-tools",
    "classification_url": "",
    "price_cents": 2400,
    "number_of_sales": 282,
    "author_username": "baileyherbert",
    "author_url": "",
    "author_image": "",
    "url": "",
    "summary": "High Resolution: Yes, Software Version: PHP 7.x, PHP 5.4, PHP 5.5, PHP 5.6, MySQL 5.x",
    "rating": 4.45,
    "rating_count": 22,
    "updated_at": "2016-07-22T16:58:54+10:00",
    "published_at": "2016-07-13T19:07:03+10:00",
    "trending": false
  "license": "Regular License",
  "support_amount": "0.00",
  "supported_until": "2018-02-07T02:13:26+11:00",
  "buyer": "collis",
  "purchase_count": 1

If the purchase code is invalid, the page returns 404 Not Found error code, and will look like this:

  "error": 404,
  "description": "No sale belonging to the current user found with that code"