Question

I'm trying to add Nokia IAP in my app and following the exact code as stated in Nokia In-App Payment Guide.

I've tested with test IDs, I can get product details and also I can purchase the item. But with an actual product, with a Published (revision 7) publication status, although I can purchase it using the getBuyIntent() method, I cannot get product details. I'm using the method getProductDetails() inside an AsyncTask doInBackground() method. And I'm getting the response from the returned bundle via:

ArrayList<String> responseList = result.getStringArrayList("DETAILS_LIST");

The responseList size is 1, and it contains the 7-digit product ID looks like:

{"isvalid":false,"productId":"*******"}

But it should contain the product details with price, right?

Also when I try to restore using getPurchases() method, it's returning with an error code 6. And if I try:

ArrayList<String> items = mBundle.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

The items object is always null.

Can anyone please help what's wrong and how to fix these? I'm using the Nokia X emulator and my product id is the numeric one. Thanks!

Was it helpful?

Solution 3

For getProductDetails() method:

  • Based on Dr. Jukka's answer, if an alias is created for a product, that must be used inside the code instead of the default numeric one.

For getPurchases() method:

  • All the codes for getting purchases should be inside an AsyncTask. The Nokia In-App Payment Guide only refers that the getProductDetails() method should not be executed in the main thread and nothing is specified for getPurchases() method. I wasn't using the AsyncTask while restoring which always returned error code 6. Now it works using the AsyncTask.

N.B. The getBuyIntent() method however doesn't need an AsyncTask, it works fine without it.

OTHER TIPS

Are you using setProductMappings-method? If not, are you giving productBundle for getPurchases? One of those is needed to be able to use getPurchases. I am not sure why you have problem with getProductDetails, but let's solve getPurchases problem first.

Another reason I got from our internal experts could be that if you are using the Product ID Alias then you must use it.

Thus to check the item from the publicer portal, and see whether you have set the Product ID Alias and indeed if you have set it, then see that you are using it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top