In-app purchases

Developers can simulate product purchase and fetching product details by using In-app purchases user interface. There is an option to enter the meta data such as global price point, description, display name, content protection method.

All the products / resources that the developer wants to sell will have a In-app IDs associated with it. The developer has to enter all In-app IDs by selecting the Add button. Any settings done in Product Details / Product Purchase will be associated with this product ID.

Figure: Purchasable Items UI

Product Details

This section will allow the developer to simulate fetching the product details. The developer has to select meta data details such as Global Price Point of the product, enter Short Description, Display name, Long Description, and content protection method which he wishes to see in the MIDlet. This allows the user to enter the same meta data for this In-app ID which is entered in the Nokia portal while registering purchasable item.

This settings will be used for simulating In-app API getProductData(..).These meta data details entered will be passed to the MIDlet In-app listener call back function productDataReceived(..). This will allow the user to show details of each purchasable item in the MIDlet UI.

The success or failure of the productDataReceived(..) call back function can be simulated by choosing Success or Fail radio button. In case of failure, the user can simulate the reason for failure by choosing any of the option in the Reason drop down list. This allows the user to simulate the scenarios like Network error, Invalid In-app ID etc. In real scenario each In-app API uses network connection; there could be a delay in response. This delay could be simulated by entering the time delay in Time Delay.

For example:

In order to get the product details successfully in the MIDlet the following settings have to be made:

  1. Enter the In-app ID which is used in the MIDlet application by clicking Add.
  2. Under Product Details section. Select Nokia DRM radio button. Enter all the meta data details of the applic ation such as Global Price Point, Short Description, Display Name, and Long Description.
  3. Select the Success button under Product Details (simulates the product Meta data is success).
  4. Enter the Time Delay (E.g.: 10 Sec, this is to simulate the response from the Nokia portal).

After doing the above settings, open the MIDlet which uses the getProductData(..) API, with the same product ID in the emulator. The user will get the above entered meta data in the MIDlet through call back function.

Product Purchase

This section allows the developer to simulate the product purchase. The user has to enter the Ticket number (The purchase ticket is in base64 encoded form. It is SHA1 (160 bit) hash. Hash is calculated over the string, which is derived by concatenating the attribute values. The attribute values are concatenated in order transactionId, transactionTime, productId, applicationId, accountId, imei, and imsi for simulation purpose the developer can enter 10 digit number.) to complete the product purchase.

These settings will be used for simulating the In-app API purchaseProduct(..). The Ticket number entered is passed to the MIDlet In-app listener call back function purchaseCompleted(..).

The success or failure of the purchaseCompleted(..) call back function can be simulated by choosing Success or Fail radio button.

In case of failure, the user can simulate the reason for failure by choosing any of the option in the Reason drop-down list. This allows the user to simulate the scenarios like Operator billing failed, No Payment cards, etc.

Time delay could be simulated by entering the time in the Time Delay edit box.

For example:

In order to successfully purchase the product the developer has to do the following settings:

  1. Enter the In-app ID which is used in the MIDlet application.
  2. Under Product Purchase section, select the Success button. Select the Status.
  3. Enter the Ticket number. Any value can be entered here.
  4. Enter the Time Delay (e.g., 10 seconds). This is to simulate the response time form the Nokia Portal.

After doing the above settings, open the MIDlet which uses the purchaseProduct(..) API in the emulator. The user will complete the product purchase through call back function.