onepf / OpenIAB

Open In-App Billing for Google Play, SlideMe, Amazon Store, Nokia Store, Samsung Apps, Yandex.Store, Appland, Aptoide, AppMall and Fortumo.
http://onepf.org/openiab/
Apache License 2.0
475 stars 171 forks source link

can not get itemdata for amazon in-app purchase #423

Closed elseswitch closed 9 years ago

elseswitch commented 9 years ago

My english is not good,i try to describe my problem clearly. i want the app work with googlepaly,yanxe and amazon,now it works fine in googleplay and yandex. but i can't get the itemdata for amazon .(use OpenIabHelper.queryInventoryAsync function).

log(OpanIAB): 12-25 11:49:19.624: D/OpenIAB(31843): checkOptions() Options={availableStores=[Store {name: com.amazon.apps}], availableStoreNames=[], preferredStoreNames=[], discoveryTimeoutMs=0, checkInventory=false, checkInventoryTimeoutMs=0, verifyMode=0, storeSearchStrategy=0, storeKeys={}, samsungCertificationRequestCode=899} 12-25 11:49:19.624: D/OpenIAB(31843): checkGoogle() verify mode = 0 12-25 11:49:19.624: D/OpenIAB(31843): checkGoogle() google key available = false 12-25 11:49:19.624: D/OpenIAB(31843): checkGoogle() ignoring GooglePlay wrapperfalse 12-25 11:49:19.634: D/OpenIAB(31843): checkSamsung() activity = air.com.joy.city.AppEntry@423cad68 12-25 11:49:19.634: D/OpenIAB(31843): hasRequestedPermission() is false for com.nokia.payment.BILLING 12-25 11:49:19.634: D/OpenIAB(31843): checkNokia() has permission = false 12-25 11:49:19.634: D/OpenIAB(31843): checkNokia() ignoring Nokia wrapper 12-25 11:49:19.634: D/OpenIAB(31843): startSetup() options = Options={availableStores=[Store {name: com.amazon.apps}], availableStoreNames=[], preferredStoreNames=[], discoveryTimeoutMs=0, checkInventory=false, checkInventoryTimeoutMs=0, verifyMode=0, storeSearchStrategy=0, storeKeys={}, samsungCertificationRequestCode=899} 12-25 11:49:19.634: D/OpenIAB(31843): setupWithStrategy() store search strategy = 0 12-25 11:49:19.634: D/OpenIAB(31843): setupWithStrategy() package name = air.com.joy.city 12-25 11:49:19.634: D/OpenIAB(31843): setupWithStrategy() package installer = com.amazon.venezia 12-25 11:49:19.664: D/OpenIAB(31843): packageInstalled() is true for com.amazon.venezia 12-25 11:49:19.674: D/OpenIAB(31843): isPackageInstaller() is true for com.amazon.venezia 12-25 11:49:20.904: D/OpenIAB(31843): finishSetup() === SETUP DONE === result: IabResult: 0, Setup ok (response: 0:OK) Appstore: Store {name: com.amazon.apps} 12-25 11:49:21.094: D/OpenIAB(31843): onUserDataResponse() reqId: 65454149-089b-4ede-bb39-4759c97c4e1e, status: SUCCESSFUL 12-25 11:49:21.094: D/OpenIAB(31843): Set current userId: DefaultTestUser 12-25 11:49:21.124: D/OpenIAB(31843): queryInventory() querySkuDetails: true moreItemSkus: [com.joy.city.code.01, com.joy.city.code.02, com.joy.city.code.03, com.joy.city.code.04, com.joy.city.code.05, com.joy.city.code.06, com.joy.city.code.07, com.joy.city.code.08, com.joy.city.code.09, com.joy.city.code.10, com.joy.city.code.11, com.joy.city.code.02_gift_01, com.joy.city.code.03_gift_01, com.joy.city.code.04_gift_01, com.joy.city.code.05_gift_01] moreSubsSkus: null 12-25 11:49:21.254: D/OpenIAB(31843): onPurchaseUpdatesResponse() reqStatus: SUCCESSFULreqId: 7bede449-1d57-427e-8989-c46b9321a78b 12-25 11:49:21.324: D/OpenIAB(31843): onItemDataResponse() reqStatus: FAILED, reqId: f286299c-5fd2-4a2d-9890-cf5871108092//(??) 12-25 11:49:21.324: D/OpenIAB(31843): queryInventory() finished. Inventory size: 0

log(AmazonSDKTester): 12-25 11:49:20.954: I/AmazonSDKTester(16733): Sending UserId Response Broadcast ({"status":"SUCCESSFUL","requestId":"65454149-089b-4ede-bb39-4759c97c4e1e","userId":"DefaultTestUser"}) 12-25 11:49:21.144: I/AmazonSDKTester(16733): Sending UserId Response Broadcast ({"status":"SUCCESSFUL","requestId":"GET_USER_ID_FOR_PURCHASE_UPDATES_PREFIX:1:450be0b9-aeac-42b2-a962-ae3a3e5c4110","userId":"DefaultTestUser"}) 12-25 11:49:21.214: I/AmazonSDKTester(16733): Sending Purchase Updates Response Broadcast ({"offset":"1419479361219","status":"SUCCESSFUL","requestId":"7bede449-1d57-427e-8989-c46b9321a78b","isMore":false,"userId":"DefaultTestUser"}) 12-25 11:49:21.284: I/AmazonSDKTester(16733): Sending Item Data Response Broadcast ({"items":{"com.joy.city.code.02":{"title":"test02","price":0.99,"description":"test02","itemType":"CONSUMABLE","smallIconUrl":"https:\/\/s3-external-1.amazonaws.com\/com-amazon-mas-catalog\/M34NVN86RJJDS5%2FM2TTBJHZB9KXVW%2Fimages%2F_c18f356b-cb85-43ef-8633-ba92c8a5620a_ee1ba88327a47ae94c9d34f8755d0a63"},"com.joy.city.code.01":{"title":"test","price":0.99,"description":"test","itemType":"CONSUMABLE","smallIconUrl":"https:\/\/s3-external-1.amazonaws.com\/com-amazon-mas-catalog\/M34NVN86RJJDS5%2FM2N3QLUG40LSSE%2Fimages%2F_9da4494a-8a02-4bf0-8790-4608d0aee6b2_ee1ba88327a47ae94c9d34f8755d0a63"}},"unavailableSkus":["com.joy.city.code.04","com.joy.city.code.03","com.joy.city.code.03_gift_01","com.joy.city.code.04_gift_01","com.joy.city.code.11","com.joy.city.code.10","com.joy.city.code.08","com.joy.city.code.02_gift_01","com.joy.city.code.07","com.joy.city.code.06","com.joy.city.code.05","com.joy.city.code.09","com.joy.city.code.05_gift_01"],"status":"SUCCESSFUL_WITH_UNAVAILABLE_SKUS","requestId":"f286299c-5fd2-4a2d-9890-cf5871108092"})

AmazonAppstoreBillingService:public Inventory queryInventory(boolean querySkuDetails, @Nullable List moreItemSkus, @Nullable List moreSubsSkus)

3

thanks very much for your help!

RomanZhilich commented 9 years ago

Hello.

From the logs you've provided, it seems like Amazon SDK tester can't find sku you requesting. Please check your JSON. If all skus are the same for all stores, you don't need to map anything.

As for your debug question (assuming it's still relevant) the problem is most likely with IDE you're using. It's probably reinstalling apk using adb install, but you must provide -i com.amazon.venezia option in order to use amazon.

elseswitch commented 9 years ago

Thanks for your reply.I may not have a clear description of the problem。 I thinks the install option is ok(already do it as your reply), I can purchase item with SDKtester and my app(pass a skuid parameter ).The only problem is when i use queryInventoryAsync function, i can't get productData.

log about sdktester: 12-26 10:13:36.763: I/AmazonSDKTester(29265): Sending Item Data Response Broadcast ({"items":{"com.joy.city.code.02":{"title":"test02","price":0.99,"description":"test02","itemType":"CONSUMABLE","smallIconUrl":"https:\/\/s3-external-1.amazonaws.com\/com-amazon-mas-catalog\/M34NVN86RJJDS5%2FM2TTBJHZB9KXVW%2Fimages%2F_c18f356b-cb85-43ef-8633-ba92c8a5620a_ee1ba88327a47ae94c9d34f8755d0a63"},"com.joy.city.code.01":{"title":"test","price":0.99,"description":"test","itemType":"CONSUMABLE","smallIconUrl":"https:\/\/s3-external-1.amazonaws.com\/com-amazon-mas-catalog\/M34NVN86RJJDS5%2FM2N3QLUG40LSSE%2Fimages%2F_9da4494a-8a02-4bf0-8790-4608d0aee6b2_ee1ba88327a47ae94c9d34f8755d0a63"}},"status":"SUCCESSFUL","requestId":"82803586-8d51-4564-9c0a-73ef8ca05d5d"})

log about openIAB: 12-26 10:13:36.803: D/OpenIAB(29010): onItemDataResponse() reqStatus: SUCCESSFUL, reqId: 82803586-8d51-4564-9c0a-73ef8ca05d5d 12-26 10:13:36.803: D/OpenIAB(29010): queryInventory() finished. Inventory size: 0

look at the log about openIAB, onItemDataResponse status is SUCCESSFUL,but when i debug the onProductDataResponse function below, final Map<String, Product> productData = productDataResponse.getProductData(); the productData have nothing. 1

but at the sdktester log above,it has all productData what i need.The requestId is same in two log.

in addition,My ide is eclipse.

RomanZhilich commented 9 years ago

Hmm.. I understand the problem. Unfortunately I have no idea what might be causing it. Can you please past here a fragment of your JSON with troublesome sku so I could try to reproduce?

elseswitch commented 9 years ago

I think I've found the cause of the problem.

https://forums.developer.amazon.com/forums/thread.jspa?messageID=13615&#13615 "Please uninstall the SDK tester from your device. Only Amazon App Tester Should be installed in the device when you are testing IAP V2 in sandbox in your app. Thanks. "

https://github.com/onepf/OpenIAB/wiki/How-To-support-Amazon-Appstore#test need update.

thanks!

RomanZhilich commented 9 years ago

So, did uninstalling Amazon store solved your problem?

elseswitch commented 9 years ago

yes,it's ok now. need change sdk tester to app tester.

RomanZhilich commented 9 years ago

Ok, grad it worked out. I'll ask @akarimova to update documentation.