How to set up player verification

Player verification is a feature that allows you to set up a webhook that your store will contact to verify if a particular IGN should be allowed to log into your store.

How it works:

  • A user visits your store and logs in by entering their username.
  • If you have player verification set up, we send a HTTP request to your verification webhook with the user’s IGN.
  • You perform any checks you choose to implement your side and return the result.
  • If the user is verified, they can log in as normal.
  • If the user is not verified, we display an error message provided by your webhook.

Because you control the verification webhook, the rules for verification are entirely up to you - for example:

  • Check the IGN has logged into your server in the past day
  • Check the IGN is registered against an account on your forum
  • Anything else you can think of!

Because you supply the error message, you could also provide instructions on what the user should do to be verified (log-in to the server, register on the forum etc).

To set up verification, you need to create a webhook - Buycraft will call your webhook and send the IGN, user’s IP address and country code as query string parameters - for example:

http://www.mydummysite.com/playerverification.php?ign=notch&ip=8.8.8.8&country=US

Your webhook should then return a JSON object with the status of the check. For successful verification, just {"verified":true} is required. For a failed verification, the verified field should be set to false, and an error message should be provided:

{
    "verified":false,
    "error":"You shall not pass!"
}

Once you’ve created your webhook, you can set it as a setting on your webstore without the query string in "Settings > Webstore":

Custom Messages

If you wish to, you can return a custom message with your verification response - this is sent as a “message” attribute to the response object:

{  
    "Verified":true,
    "message":"Welcome back, we have added 5 new products since your last visit!"
}

By default, this will be shown as a standard success notification. However, if you want to include it in your template, you can also do so by using the {{ store.userMessage }} variable. This is recommended because if the success notification is over-written by another notification (for example if you apply a coupon), then the notification may not be disabled.

User Actions

As an extension to the verification system, you can instruct the store to perform certain actions for the logged in user. These are:

  • Apply a sale that would otherwise be inactive
  • Automatically apply a coupon code
  • Allow the user to see a category that would otherwise be disabled
  • Allow the user to see a package that would otherwise be disabled

To do this, you pass through an additional ‘actions’ object as part of your response - this can contain one or more of the above actions - the value of each is an array of one or more ID's or coupon codes that the rule should be applied to:

{  
   "verified":true,
   "actions":{  
      "enable_sales":[  
         6
      ],
      "apply_coupons":[  
         "HIDDENCODE", "ANOTHERCODE"
      ],
      "enable_categories":[  
         103
      ],
      "enable_packages":[  
         242
      ]
   }
}

If you only want to use one of the rules (for example, just enable a category), then you only need to supply that rule:

{  
   "verified":true,
   "actions":{  
      "enable_categories":[  
         103
      ]
   }
}

Still need help? Contact Us Contact Us