question

rititk avatar image
rititk asked

invalid sku error

i am not able to understand that what is sku and how can i get a valid sku for test my application's inAppPurchasing. error is - onPurchaseResponse: invalid SKU! Should never get here, onItemDataResponse should have disabled buy button already pls help me sir
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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Ritik, A purchasable item is anything that a customer can purchase from within your app. Purchasable items require you to implement how your app uses these items; Each purchasable item is identified by an unique string called SKU. A SKU (technically a stock-keeping unit) is a unique identifier for each distinct purchasable item. It is unique to you (specifically your developer account registered on the Distribution Portal), and is a (up to) 150-character length string of arbitrary structure that can contain the characters a-z, A-Z, 0-9, underscores, periods, and dashes, and is case sensitive. Purchasable items and SKUs have a 1:1 mapping. Your app will pass the SKU value via the In-App Purchasing API class to the client. The SKU is how the client knows what the customer is trying to purchase, and will manage the purchase flow accordingly. You need to ensure that every purchasable item you define has a unique SKU. The SKUs are unique across your developer account. When you submit SKUs for multiple apps you need to ensure that there is no overlap. Before a SKU can be used, it must be configured via the Distribution Portal. Refer to the Submitting Your App and In-App Items section for information on how to configure SKUs in the Developer Portal. As long as you define the appropriate SKUs within the Distribution Portal for your app, you can distribute your app through any other marketplace or catalog. While testing in app purchase in sandbox environment you have to install sdk tester app and provide all the item definition locally in a json file. The SDK Tester Uses a JavaScript Object Notation (JSON) text file to contain the IAP item information used to respond to IAP API calls. This file resides on the device containing the app under test and the SDK Tester. Once created, the file needs to reside on the device's file system under the path: /mnt/sdcard/amazon.sdktester.json The contents of the file is a list of JSON objects that should have the same properties as the IAP items that you entered into the Distribution Portal. This ensures you are testing with the same item attributes that will be available in the live environment. The overall format of the JSON file is: { SKU_1:{IAP_Item_1_Description}, SKU_2:{IAP_Item_2_Description}, . . . SKU_n:{IAP_Item_n_Description} } Each item description definition varies by IAP Item type. The order of the IAP items in the JSON file is not significant. Note the comma "," between description definitions. Here are examples of a consumable and entitlement item taken from the Amazon IAP Sample Apps". You can download the source code (and SDK Tester JSON file) from the Distribution Portal. { "com.amazon.sample.iap.consumables.orange" : { "itemType": "CONSUMABLE", "price": 10.00, "title": "Orange", "description": "An orange" } "com.amazon.sample.iap.entitlements.level2" : { "itemType": "ENTITLED", "price": 10.00, "title": "Level 2", "description": "An entitlement to play level 2" } } Now having the purchasable items defined correctly in amazon.sdktester.json in sdcard and also with the present of sdk tester app in the device you can test entire flow of purchase, getting available purchasable items etc. Please refer below link for better understanding of IAP testing in sandbox mode. https://developer.amazon.com/sdk/in-app-purchasing/documentation/testing-iap.html
10 |5000

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

rititk avatar image
rititk answered
thanks sir it works fine . but when i click on purchase .it shows me successful purchase ...but sir i am not getting the event of this purchase button of interstitial dialog.so that i can show the result of purchase in my game.
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
In order to receive the callbacks in the instance of derived class of BasePurchasingObserver, you have to declare the receiver in the AndroidManifest.xml Please refer : https://developer.amazon.com/sdk/in-app-purchasing/documentation/quick-start.html#Step%202
10 |5000

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