Start the dynamic item purchase flow
purchaseItemsRemote(order_information, callback)

Requesting Remote/Dynamic Item Purchase

You may start the Dynamic Purchasing API purchase flow using the purchaseItemsRemote method on the mtx services object. It accepts an order info string which will be passed to your API callback as a signed request, as well as a callback function which should be called with the result of the purchase:

NameTypeDescription
order_informationStringAn order info string that will be passed to your server in an API callback.
callbackFunctionA callback function for when the purchase dialog is closed.

The callback function is passed a single object with the following fields:

NameTypeDescription
successBooleanA flag indicating whether or not the purchase was successful.
item_order_idIntegerThe unique ID of the transaction, or undefined if the purchase failed

Example: Starting a dynamic item purchase with order info set to 'sword':

mergeInto(LibraryManager.library, {
  PurchaseItemsRemote: function (str) {
    var stringArray = [];
    stringArray.push(UTF8ToString(str));
    kongregate.mtx.purchaseItemsRemote(stringArray, function(result){{
          var status = result.success ? 'SUCCESS' : 'FAIL';
          // Fire the callback in the Unity code
          kongregateUnitySupport.getUnityObject().SendMessage('KongregateAPIBehaviour', 'OnRemotePurchaseProductResult', status);
        }});
  }
});
[DllImport("__Internal")]
private static extern void PurchaseItemsRemote(string item);

PurchaseItemsRemote("sword");

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

Once the purchase dialog is invoked, the item_order_request signed request callback will be initiated to your API callback URL so that your game server can define the items to be purchased dynamically.