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':

kongregate.mtx.purchaseItemsRemote("sword", onPurchaseResult);
 
function onPurchaseResult(result:Object):void {
  trace("Purchase success:" + result.success + ", id: " + result.item_order_id);
}
kongregate.mtx.purchaseItemsRemote("sword", onPurchaseResult);
 
function onPurchaseResult(result) {
  trace("Purchase success:" + result.success + ", id: " + result.item_order_id);
}
Application.ExternalEval(@"
  kongregate.mtx.purchaseItemsRemote('sword', function(result) {
    var unityObject = kongregateUnitySupport.getUnityObject();
    var success = String(result.success);
    unityObject.SendMessage('MyGameObject', 'OnRemotePurchaseResult', success);
  });
");

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.