Kongregate Developers

Requesting Remote/Dynamic Item Purchase

You may start the dynamic item order purchase flow using the purchaseItemsRemote method on the microtransaction 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, as shown below:

purchaseItemsRemote(orderInfo:String, callback:Function):void
  • orderInfo:String - An order info string that will be passed to your server in an API callback.
  • callback:Function - The callback function

The callback will be called with a single Object argument which has one field:

  • success:Boolean - True if the user successfully purchased the items
  • item_order_id:int - The unique ID of the transaction, or undefined if the purchase failed

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

// Begin dynamic item purchase flow
kongregate.mtx.purchaseItemsRemote("sword", onPurchaseResult );

// The purchase callback
function onPurchaseResult(result:Object){
  trace("Purchase success:" + result.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.