Start the purchase flow for predefined items
purchaseItems(items, callback)

Requesting Item Purchase

You may bring up the "purchase items" dialog box by using the purchaseItems method on the mtx property on the Kongregate API object. It takes either an array of item identifiers or an array of identifier/metadata objects, as well as a callback function which should be called with the result of the purchase:

itemsArrayArray of item identifier strings, or an array of objects each with an identifier and data field.
callbackFunctionA callback function for when the purchase dialog is closed.

The callback function is passed an object with the following fields:

successBooleanA flag indicating whether or not the purchase was successful.

Example: Purchasing a single item with identifier "sword":

mergeInto(LibraryManager.library, {
  PurchaseItems: function (str) {
    var stringArray = [];
    kongregate.mtx.purchaseItems(stringArray, function(result){{
          var status = result.success ? 'SUCCESS' : 'FAIL';
          // Fire the callback in the Unity code
          kongregateUnitySupport.getUnityObject().SendMessage('KongregateAPIBehaviour', 'OnPurchaseProductResult', status);
private static extern void PurchaseItems(string item);


 void OnPurchaseProductResult(string result)
     Debug.Log("OnPurchaseProductResult: " + result);


You can attach a metadata string to the item instance if needed which can be retrieved from the server later. It is important to note that the client can change this data using a browser plugin fairly easily, so it is a good idea to obfuscate this string, as well as verify its validity as it relates to your game.

Example: Purchasing an item with metadata attached:

var items = [{identifier:"sword", data:"+1str"}];
kongregate.mtx.purchaseItems(items, onPurchaseResult);

function onPurchaseResult(result) {
  console.log("Purchase success:" + result.success);