Earning Revenue Through in-App Purchases On Windows Store

Introduction and Background

A small overview of in-app purchases in Windows Store platform, in this post I will only cover the short summaries of quickly editing the small modules that you have recently created and to enable users to purchase them to support your development environments. Building applications is a tough task, and programmers need to be given what they deserve. Sometimes, respect is just not enough. Sometimes, the module you created is a tough one and you have full rights to ask for some money in a repay. It is your choice to select a price that users have to pay before they can consume the service.

Windows Store allows you to simply create a block of code, around the service, feature or application itself. That code is capable of managing the payment information, client information and other required stuff to make sure the user pays you before they can access the information and the service you are providing them with. Windows Store holds information for users too, it knows if a user has already made the purchase. If so, Windows Store won’t bother the users again to make the purchase and will hold the information for that license, user has acquired.

App monetization methods

On Windows Store you are offered with many methods and ways to earn money and to get support for your development environments and stuff! A few of them are:

  1. Ads display in your application.

    • The ads are of both types, static images and videos.

  2. Providing paid services in your applications.

  3. Asking for a pre-use purchase of your application. Paid apps.

You can ask for an upfront payment by your users. Many application developers use this method to support their development scenarios. This allows them to have an upfront payment to continue their programming and to support any of the updates to their clients. Not just this, the clients are also able to get free updates to the application later one.

But sometimes you want to allow your users to download and install the applications for free! This allows you to allow your users to try out your application. Users like free stuff, especially the stuff that is not available currently in their device’s marketplace. You can develop an application and start to offer a trial-period to allow users to use your service. If they like it, you can then ask them to purchase the license.

Otherwise, you can add a service separately that needs users to purchase it. You can add the price for it and allow users to purchase it. This method is very simple, helpful and handy! Your users can try out the application that they want to, and you can get the revenue for the features that were difficult to build and deploy. In this post, I will discuss and talk about the monetization methods by “in-app purchases” in Windows Store applications.

In-app purchases in Windows Store apps

In-app purchases requires you to have a Windows Store developer account and that you have published your application! In-app purchases are edited (and published) from the Windows Store dashboard. You create a new in-app purchase in the dashboard, you edit the details and then update the application’s code to call those in-app purchases and provide the users with a service.

If you do not have a Windows Store developer account, you can still edit the application, you can test the license information but you won’t be able to publish the application, you won’t be able to ask your users (if any!) to purchase the services. So, first step would be to create a new developer account. Register as a developer.

If you are all set up for publishing a new application, continue with the sections and by the end you will be able to include in-app purchases for earning some revenue for your development tasks!

Creating a new app

Although, for development purposes you can test the application for performing the purchases without an online application, or a developer account. For that, you can use CurrentAppSimulator object, instead of CurrentApp object from Windows Store API. CurrentAppSimulator allows you to perform actions
without having to call the active Windows Store APIs, and to just test the code in your application. This
lets you test many things in your application and how user interacts with your application.

However, if you do not like to waste time, you can just head over to the “hard core” stuff. Where you publish an application, create a new in-app and start consuming it and allowing the users to purchase it. First of all, head over to the dashboard (provided: You have a developer account!) and create a new application. Publish it to the store.

Note: Developing application, uploading the source code and getting it to be published after verification takes time. My application took 16+ hours. Yours should have to go through the same procedure so be patient. I assume that you are having an application ready.

Once your application is created, continue to the next section and start creating and developing for an in-app purchase.

Creating the in-app product

The in-app product first needs to be defined in the Windows Store and the team then needs to approve the service. Once the product service has been approved by the team, you can use the product ID of that service to program your application. The product ID is used to check the license information for the application and if user owns the license to use the service or not.

License Information

License Information object of the application holds the information about the license. License can be checked for,

  1. ExpirationDate
  2. IsActive
  3. IsTrial
  4. ProductLicenses

These properties can be checked to determine the information about license of the application (if your application is a paid application), otherwise you can check for licenses of the in-app products. The in-app products also have a license and they also have properties set up, like active, trial etc. You can check against them!

An example of this license information is something like this,

  1. var license = CurrentApp.LicenseInformation;  
  2.   
  3. if (license.IsActive)  
  4. {  
  5.     // License is active  
  6.     // Allow user to use the service.  
  7. else  
  8. {  
  9.     // Allow the users to purchase the service.  
  10. }  
The same applies to in-app products! You would use the same method, the code for in-apps is in a later section so continue to read.

Create a product in Windows Store

You will be able to create a new in-app product online, on your application’s dashboard! Head over there and find the following option.

IAPs
   Figure 1: Windows Store showing IAPs option

Click on this option and it would take you a new page where you can create a new IAP! Click on, “Create a new IAP” and enter a new product ID.

create
                    Figure 2: Enter a new product ID here and click on “Create IAP”.

You may have read that you need to be sure of the name. You won’t be able to update or delete it once you publish it.

Editing the in-app product

You will then be able to update the properties for that product in Windows Store. This is when your updates and properties would need to be verified. You will get the following three properties that you can edit to make your product a bit “understandable”.
  1. Properties

    • Type of the purchase:
    • Consumables are those services that can be consumed. Like, 500 gold coins! Users can use them and re-purchase them.
    • Durables are those who have a lifetime. Like a premium service of 30 days.
    • Content type
    • Keywords
    • Tag

  2. Pricing and availability

    • Base price
    • A few other settings like Markets to sell the product in.

  3. Descriptions

    • Language
    • Description and title for the purchase. This is shown in the Windows Store.

You can edit the properties there, and then continue to submit it to the store. The team there would read the information and would approve it if there aren’t any problems with it. Chances are, it gets approved within an hour. Then you would continue to write the code to handle the products.
Remember: It takes at least one day to make the changes on the system. So, even if you upload the package along with the products, it would take one day for Windows Store to be able to start selling your products.

Writing the application to provide services

The Windows Store side is a very short process that you can perform in within less than 30 minutes. The longer part is to write the source code to handle the user’s license and to allow or request the user to purchase the license and service. The code is very short, intuitive and simple! I will explain the entire process here, so that it is very easy for you to get started earning revenues from Windows Store applications that you build.

Create a module

I wonder why this section even exists. Just create a module, a function or a service that performs some actions in your application. Suppose, you want to earn something from it. You can create it as a function, so that you can wrap the function within another code block that checks for a license. License information would be used to either allow the user to consume the service or to reject the request and to ask the user to purchase the service from Windows Store.

Add the license check-up!

I shared a code above, to determine the license for the application, you would do the same in case of in-app product too. You would see if a user has the license or not. The following code would do the thing for you:

  1. // Remember the license object we created above?  
  2. if (license.ProductLicenses["productId"].IsActive)   
  3. {  
  4.     // productId that you created while creating the in-app product  
  5.   
  6.     // The user owns the license to use it.  
  7. else   
  8. {  
  9.     // Ask the user to get a licence.  
  10. }  
You can use the CurrentApp.RequestProductPurchaseAsync(“productId”) function to allow the user to purchase the product from Windows Store. Windows Store would open a new window for the user to make a purchase. You can then (as its result) check if the user made the purchase or not. If he made the purchase, then allow him to use the service otherwise just end the request.

The common example for this would be like the following:
  1. // Get the license for the user  
  2. var license = CurrentApp.LicenseInformation;  
  3.   
  4. // License for the in-app  
  5. variapLicense = license.ProductLicenses["productId"];  
  6.   
  7. // Apply a condition for the in-app product license  
  8. if (iapLicense.IsActive)  
  9. {  
  10.     // User has bought the service; provide service  
  11.     provideService();  
  12. else   
  13. {  
  14.     // Allow user to purchase it  
  15.     awaitvarresultOfPurchase = CurrentApp.RequestProductPurchaseAsync("productId");  
  16.     if (resultOfPurchase.Status == ProductPurchaseStatus.Succeeded)  
  17.     {  
  18.         // User has bought the service now  
  19.     } else  
  20.     {  
  21.         // Show the error message; for try again.  
  22.     }  
  23. }  
This way, user would be able to purchase the item from Windows Store. The process is mostly similar to this one:

run
Figure 3: Windows Store purchase window is loading up.

buy
Figure 4: Windows Store shows the details for the purchase the user is about to make. Also allows them to add a payment method to their account.

pay
Figure 5: Windows Store shows the following methods (or any other, or less; depending on the country of users) to allow them to make the purchase.

This would then allow the users to make a payment and then it would update their licenses to be able to consume the service later. It would update the “IsActive” property of their license information.

Points of Interest
 
In this post you were taught how to earn revenue from your Windows Store applications. MSDN documentation has a lot of great resources available for developers to learn more about in-app purchases and services provided to developers to ensure that users pay for their services and for the users, to allow developers that they have indeed made the purchase and you should allow them to use the service.

There are many other topics that you should consider reading, such as:
  1. Allowing consuming of services like tokens.
  2. Managing the services from Windows Store.
  3. Adding more in-app products.
  4. Using receipts to verify the purchase status.
  5. Validating the receipts of services.

As a further read, you should consider reading “Enable in-app product purchases” guide on MSDN. I hope I have helped you with this post, and I think this is the last post for 2015, catch you in the next year.

Happy New Year!


Similar Articles