Purchase Code: What Is It and Why Should You Use It?

Now you can protect your original works from unlawful usage with an automatically generated purchase code which is individual for each product. It is issued during the purchase process and is mated with the product’s License Certificate.

With its help, every author can determine if purchased assets are used according to all the terms and regulations. The purchase code will work for uploaded templates and plugins presented on the TemplateMonster marketplace and covered by the MonsterONE subscription. 


It’s really important to have the purchase code. We’ll show you how to create a Purchase code and why it’s so helpful in a short walkthrough video.

Video-review of the Purchase Code feature.

How to Protect Products with a Purchase Code? 

The use of the purchase code is not mandatory. Each author chooses whether to use it or not. If you decide that your items should have it, there are a couple of things to consider:

  • It will prevent the violation of copyrights and minimize damage to your web assets. 
  • The purchase code can be used for templates and plugins only. 
  • The purchase code is not required. Meaning you can still upload products and continue selling them without it.
  • Please follow the API instructions once you decide to validate the purchase code. 

What’s More?

We’ve analyzed and evaluated the effectiveness of the purchase code to conclude that it can effectively address possible security gaps. We strongly recommend using it to protect authors’ rights. Please don’t hesitate to contact us via online support if you have any additional questions regarding using a purchase code. Hurry up and secure your artwork without delay!


We’re using OAuth 2.0 for user authorization. You have to get and save access_token & refresh_token in

your storage, TTL for access_token is 14 days, for refresh token is 30 days. Refresh your access token every 10-12 days. Get a purchase code from a customer and check it. 


Login

For get access_token & refresh_token send request:

  • Request URL: https://users.templatemonster.com/api/v1/users/login
  • Request Method: POST
  • Form data:
    • login: tester@templatemonster.me
    • password: super-secret-Password_123
  • scope: deliveries

Response 1:

{
"access_token":"qzpLFWKjq7WiS75BJjeuQPo284b4rLd88jTOiO8o",
"token_type":"Bearer",
"expires_in":1209600,
"refresh_token":"BPwqOqEUBYo5euwHUppphXB7ia8nI5keFI5Qhwwl",
"owner_id":682040,
"required_password_change":0,
"confirm_new_ip":0
}

Response 2 (required_password_change): 

You have to change your password every 180 days.

If token_type is required_password_change, visit https://account.templatemonster.com/auth/ and change it

{
"owner_id":682040,
"refresh_token":"",
"access_token":"uqcxSKKIPwSHcDV_mXZWGgcte9EK1DlRmR_6T-X9",
"token_type":"required_password_change",
"expires_in":86400,
"required_password_change":1,
"confirm_new_ip":0,
"owner_type":"user"
}

Response 3 (confirm_new_ip): 

You have to confirm your new IP. If token_type is confirm_new_ip, check your email and confirm new IP.

{
"owner_id":682040,
"refresh_token":"",
"access_token":"",
"token_type":"confirm_new_ip",
"expires_in":86400,
"required_password_change":0,
"confirm_new_ip":1,
"owner_type":"user”
}

Check valid access token

Access token is qzpLFWKjq7WiS75BJjeuQPo284b4rLd88jTOiO8o

  • Send request:
  • Request URL: https://api.templatemonster.com/oauth/tokeninfo
  • Request Method: GET
  • Headers:
  • Authorization: qzpLFWKjq7WiS75BJjeuQPo284b4rLd88jTOiO8o

Response 1 (valid token):

Status Code: 200 

{
"owner_id":"682040",
"owner_type":"user",
"access_token":"qzpLFWKjq7WiS75BJjeuQPo284b4rLd88jTOiO8o",
"client_id":"ykzTbRShmKBNMNBfSgMY0JQYrKXGTEvqnPOgt1Ra",
"scopes":{"deliveries":{"id":"deliveries","description":"service deliveries"}}
}

Response 2 (invalid token):

Status Code: 401 


Refresh access token

Refresh token is BPwqOqEUBYo5euwHUppphXB7ia8nI5keFI5Qhwwl

  • Send request:
  • Request URL: https://api.templatemonster.com/oauth/token
  • Request Method: POST
  • Form data:
    • grant_type: refresh_token
    • refresh_token: BPwqOqEUBYo5euwHUppphXB7ia8nI5keFI5Qhwwl
    • client_id: ykzTbRShmKBNMNBfSgMY0JQYrKXGTEvqnPOgt1Ra
    • scope: deliveries

Response 1 (valid token):

Status Code: 200 

{
    "access_token": "Ec4n98WjhP2SAjwhvO9jnAZaWQQs7anUmIvx7Gwj",
    "token_type": "Bearer",
    "expires_in": 1209600,
    "refresh_token": "H6LYjXeOUcF0vSKogVK8wa2ko4TXWsIcZinOBZZa",
    "owner_id": null
}

Response 2 (invalid token):

Status Code: 400 


Check purchase code

  • Purchase code is 620102a923771e1e705ec1a5
  • Send request:
  • Request URL: https://api.templatemonster.com/delivery/v1/deliveries/620102a923771e1e705ec1a5
  • Request Method: GET
  • Headers:
  • Authorization: qzpLFWKjq7WiS75BJjeuQPo284b4rLd88jTOiO8o

Response 1 (valid):

Status Code: 200 

{
    "id": "620102a923771e1e705ec1a5",
    "user_id": "682040",
    "order_id": "Fjwt1aHvisdRZpR28sDB",
    "product_id": "57671",
    "product_type": "template",
    "provider": "Delivery",
    "name": "downloadLink",
    "type": "link",
    "value": null
}

Response 2 (invalid):

Status Code: 404


Check product info

  • Product id is 57671
  • Send request:
  • Request URL: https://api.templatemonster.com/products/v2/products/57671
  • Request Method: GET
Can`t find the answer to your question?