Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

static function PurchaseApp(): string;
static string PurchaseApp();
static def PurchaseApp() as string

Description

Attempts to purchase the app if it is in installed in trial mode. This API is supported only on Windows Phone 8 and Windows Store Apps.

Behaviour on Windows Phone 8: Redirects the user to application page on the Store. Returns an empty string. You can use isOnAppTrial afterwards to find out whether the user bought the application.

Behaviour on Windows Store Apps: Pops up a dialog for a user asking whether he wants to buy the application. If use buys an app, returns a valid purchase receipt string. Otherwise, returns an empty string.

var m_Receipt : string;
function OnGUI () {
	if (LicenseInformation.isOnAppTrial) {
		if (GUI.Button (Rect (10, 10, 100, 40), "Buy full version")) {
			m_Receipt = LicenseInformation.PurchaseApp ();
		}
	} else {
		GUI.Label (Rect (10, 10, 100, 40), "You have full application version installed");
	}
}
no example available in C#
no example available in Boo