question

achooley avatar image
achooley asked

onProductDataResponse empty

Hi. Iam implement In-app purchasing 2.0 and have same problem. I installed Amazon App Tester.apk and put json file from sdk(amazon.sdktester.json) to sdcard. "{ "com.amazon.sample.iap.consumable.orange" : { "itemType": "CONSUMABLE", "price": 10.00, "title": "Orange", "description": "An orange; オレンジ;橙;Una naranja;оранжевый;오렌지" } }" Whan i call PurchasingService.getProductData(productSkus) with product sku:"com.amazon.sample.iap.consumable.orange" i have answer {"UNAVAILABLE_SKUS":"[]","requestStatus":"SUCCESSFUL","requestId":"b23ccec7-2f96-42e9-be7f-7f0779247e25","productData":{}} Where is description of my product(orange)??? when i call PurchasingService.purchase(sku) sku:"com.amazon.sample.iap.consumable.orange" everything is fine. Answer : {"userData":{"marketplace":"","userId":""},"requestStatus":"SUCCESSFUL","requestId":"abe950ac-43a1-421b-8ad8-2d04299070e9","receipt":{"sku":"com.amazon.sample.iap.consumable.orange","purchaseDate":"Fri Jan 30 14:30:56 EET 2015","itemType":"CONSUMABLE","receiptId":"q1YqVrJSSs7P1UvMTazKz9MrTswtyEnVy0ws0EvOzysuzU1MAnLzixLz0lOVdJRSgKoNTYyMzIwMDUzNLI3MgWKlQLEcYw8f84iCAlffjCJ_d5e80iJL3dKcssL83KLgdLPCSn8X79zEDHOzHK9QW6CWEiUrg1oA"}}
iap
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

WangChao@Amazon avatar image
WangChao@Amazon answered
Hello, Please check the following sample code: @Override public void onProductDataResponse(final ProductDataResponse response) { final ProductDataResponse.RequestStatus status = response.getRequestStatus(); switch (status) { case SUCCESSFUL: final Map products = response.getProductData(); Log.d(TAG, "onProductDataResponse:available skus: " + products.size()); for (final String key : products.keySet()) { Product product = products.get(key); Log.v(TAG, String.format("onProductDataResponse Product: %s\n Type: %s\n SKU: %s\n Price: %s\n Description: %s\n", product.getTitle(), product.getProductType(), product.getSku(), product.getPrice(), product.getDescription())); } final Set unavailableSkus = response.getUnavailableSkus(); Log.d(TAG, "onProductDataResponse: " + unavailableSkus.size() + " unavailable skus"); break; case FAILED: Log.d(TAG, "onProductDataResponse: FAILED"); break; case NOT_SUPPORTED: Log.d(TAG, "onProductDataResponse: NOT_SUPPORTED"); break; } }
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.