Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tier 1 Amazon App store IAP?

Author
Message
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 27th May 2016 17:06
Hi, I've lost track - does AppGameKit 2.19 support IAP bought from the Amazon App Store? When I select the 'Amazon APK' type, all permissions except Write Internal Storage, Wake Lock and Internet/wifi access become greyed out. Though if you tick the In App Purchase box before hand, it doesn't get cleared...

The docs for InAppPurchaseAddProductID only mention Google Play and iOS.
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 28th May 2016 09:27
+1 for this. It's been missing for a while.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 29th May 2016 21:55 Edited at: 29th May 2016 21:55
I've seen no mention that this is supported yet, although it has been requested by users for over two years now. It is essential to ensure apps can consistently be deployed across all three major platforms.
Parry
AGK Developer
14
Years of Service
User Offline
Joined: 16th Dec 2009
Location: Swampstone
Posted: 30th May 2016 02:02
+1 for this from me too!
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 5th Jun 2016 16:54
Yes, +1 for this. +999999

Or tell us that it can't or won't be done.

According to Amazon's own statistics, Amazon is the most lucrative market to be in.

(yes of course I realize "According to Amazon's own statistics" , that's why I said it, but still...)

Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 24th Jun 2016 12:12
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 7th Sep 2016 13:23
well, according to the new version 2.0.21 , amazon IAP are supported.. YAY!

I have not done it yet, but hopefully it's working.

(tentative) thanks to TGC!
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 7th Sep 2016 22:11
Yaaaaay awesome update!
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 7th Sep 2016 22:12
Yaaaaay awesome update!
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 14th Sep 2016 13:31
I'm having no luck setting up IAP on Amazon.
After doing the inAppPurchaseSetTitle() --> inAppPurchaseAddProductID() --> InAppPurchaseSetKeys() --> and finally inAppPurchaseSetup(), the Fire TV reports "Cannot start purchase until Setup is finished, please try again in a minute." No amount of waiting helps, but it could be down to the fact that its not clear what key to use in InAppPurchaseSetKeys() on Amazon, but I've tried a bunch

Does the apk need to be on the store first? I've set the Security Profile using the md5 from a signed build. Does it want the Client Secret from that, or the 'Login with Amazon' base 64?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 14th Sep 2016 15:46
Amazon does not require any keys to be set, if you do they will be ignored. Amazon have a completely offline method of testing IAP, if you want to test online you have to use the Live App Testing on their developer console to upload the APK you want to test with and then download it from their website (you can't side load to test IAP online). You can read more about it here https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/testing-iap-2.0 and you can download the offline test app here https://www.amazon.com/Amazon-App-Tester/dp/B00BN3YZM2/. When using the offline test app you will need to supply it with the list of IAP products so it can respond to your purchase requests, this is done by giving it a JSON file which can be downloaded from the Amazon developer console once you have added your IAP products to it. Note that the string passed to InAppPurchaseAddProduct must be the SKU value used on the Amazon developer console when you added the IAP to their site.
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 15th Sep 2016 10:31
Alrighty. I had the tester installed with the correct json file but hadn't submitted to live app testing.

When doing the purchase I check for getInAppPurchaseState() to return 1 (same as Google Play and iOS) but it doesn't seem to on Amazon (and the AppGameKit doc entry only mentions iOS and Google). This leaves my app hanging, but when I retarted it the purchase has completed correctly. Do we need a different code path on Amazon, omitting getInAppPurchaseState()?

Oe last thing, Amazon is reporting a testing Issue- 'Incorrect Usage of Amazon IAP' - your app or game has not implemented receiver component or mandatory API calls corresponding to an IAP purchase that you have initiated. This could lead to failed purchases'
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 15th Sep 2016 14:54
Ok I'm not getting it. The Amazon IAP tester is installed and references a valid JSON. When I launch my app and start the IAP process, it buys the IAP from my user account, not the IAP tester. Even though my app has not been published to the store.
There is no way to reverse that for further testing.

Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 19th Sep 2016 14:12
I tried to speed up the testing process by adding a dummy unmanaged IAP (100coins) that could be bought multiple times; nothing seems to make my app interact with the Amazon Tester App. No transactions are generated.
At this point I'm more concerned with this though:

Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 22nd Sep 2016 14:46
One bit of good news, I ordered an Amazon FireTv Game Controller and it works just fine with AGK.
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 27th Sep 2016 15:30 Edited at: 27th Sep 2016 21:25

Another problem: Apps submitted to Amazon Live App testing are not being registered as 'Updated' after the first submission.
My first submission was Version Name "2.2.1", Version Number "60"; the next version was Version Name "2.2.2", Version Number "61". On submission of the update, Amazons information page says the current version is version "2.2.2" but when downloaded, the apk is actually "2.2.1"


Nevermind, looks like a problem on Amazons end. It has an incredibly slow turn-around and I havent completed a cycle in less than 2 hours yet.
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 29th Sep 2016 13:15 Edited at: 30th Sep 2016 09:40
I changed some IAP code around and now the Amazon compatibility test is only complaining about 'Google In-App Billing Detected' as a caution.


Paul, please post some Tier 1 Amazon IAP code that works with the App Tester. Nothing I have done so far works, meaning I have to upload new builds to test minor changes and Amazon sometimes takes 5-6 hours to process each test.
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 30th Sep 2016 09:40
Aha, whoops. I'd forgotten that I'd set APK Type to Google in the export dialogue.
So: Amazon will reject an APK exported as Amazon APK type, but accepts one built as Google APK type.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th Sep 2016 21:53
I've attached a json file you can use with the offline tester and the AppGameKit Player. Add the product to AppGameKit like so
InAppPurchaseAddProductID( "com.thegamecreators.agk_player2.agk_free_consumable" )
No need to set any keys for Amazon. You can generate a json file with your own IAPs from the Amazon developer console. In the place where you created the IAP products should be an option to download the json file.

Quote: "Amazon will reject an APK exported as Amazon APK type, but accepts one built as Google APK type."

Does it say why it was rejected?

Attachments

Login to view attachments
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 4th Oct 2016 16:18
It states why in the screenshot above: "Your app or game has not implemented receiver component or mandatory API calls..." etc, although IAP purchases do work on the platform.
I'll try your json file tonight.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Oct 2016 16:30
It looks like I forgot to add the receiver to the IDE Amazon export manifest. I've included a fixed version which should remove the error. Place it in "Tier 1\Editor\data\android\sourceAmazon" then export as normal.

Attachments

Login to view attachments
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 6th Oct 2016 18:38
Ok that cleared the Compatibility Test errors/warnings, but my APK is still not talking to the Amazon App Tester.

My workflow:
1. Build Amazon APK with with fresh version number, "com.thegamecreators.agk_player2.agk_free_consumable" added as IAP entry; Signed build.
2. Copy amazon.sdktester.json to /sdcard of test device
3. Check Amazon App Tester; logged in as User 1; check IAP Items in JSON File (all displayed and correct)
4. Upload build to Live App Testing, wait for build to propagate to Test devices, download and install
5. Open app, attempt purchase. App ignores Amazon App Tester and accesses Amazon store directly. After purchase, nothing shows up under Manage Transactions in App Tester.

This happens whether the IAP has been added to the projects IAP list on the Amazon developer dashboard or not.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 6th Oct 2016 20:27
It sounds like you are mixing online and offline testing. If you upload to the live app test page then you don't need the Amazon App Tester app. If you side load the APK on to your device then you use the Amazon App tester app, and you don't send anything to the live app test page.
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 7th Oct 2016 16:21
Ah you're right of course, I had tested myself into a hole. The App Tester didn't work before when the app was side-loaded, due to the missing receiver in the manifest.

Now I can test with the App Tester and have a bug: on Amazon, getInAppPurchaseState() never completes for a failed purchase.

- in API Response Settings, set Purchase API to SUCCESSFUL.
- Purchase an item twice.
- The second time, the App Tester responds with a 'You already own this item' dialogue but getInAppPurchaseState() does not return 1 for completed.

- Now no other purchases are possible, trying to buy any item results in the message 'Cannot start purchase as a purchase is already in progress'. I think this message is coming from AppGameKit as its a standard AppGameKit Message dialogue, not the Amazon App Tester one.


Finally, even though the App Tester is reporting the item has previously been purchased, GetInAppPurchaseAvailable(id) is returning 0 while getInAppPurchaseLocalPrice(id) and GetInAppPurchaseDescription(id) are returning empty strings.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Oct 2016 20:37
It looks like you may be buying an entitlement (buy once) whilst calling InAppPurchaseAddProductID with the second parameter equal to 1 (consumable)? That's the only way I could trigger this bug.
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 10th Oct 2016 12:18 Edited at: 11th Oct 2016 16:18
No, the product ID Type parameter was set to 0.

Attached is a test project and an unsigned apk:


1. Amazon App Tester: Log in as User 1, set all API Response Settings to 'SUCCESSFUL', delete all previous transactions.
2. Install and run testiap.apk
3. Tap the green 'Entitled' button on the right. Tap 'Get Item' in the Amazon Apps dialogue. Tap 'Close'
4. If you tap the 'Entitled' button again, the Message box 'You have already purchased that item' appears.
5. Quit and stop the app completely.
6. This Notification has appeared in the notification area:

7. Run the app again. Tap the green 'Entitled' button. Tap 'Get Item' in the Amazon Apps dialogue; new dialogue box says 'You already own this item'. Tap close.
8. App hangs because GetInAppPurchaseState() does not return 1.

So the problem manifests after an Entitlement has been purchased and the app is closed and restarted. If you exit out of the loop after iTryCount has exceeded a certain number, the app cannot start a new purchase because it hasn't completed the previous transaction.

In addition, GetInAppPurchaseAvailable() on an item only returns 1 immediately after that item has been bought. InAppPurchaseRestore() does not refresh the state either.

Results of App Tester API Response Settings after an Entitlement has been purchased:
'SUCCESSFUL' - Buy dialogue opens, app hangs after tapping 'Close' in the 'You already own this item' dialogue
'FAILED' - GetInAppPurchaseState() returns 1 instantly, no hang.
'ALREADY_PURCHASED' - no dialogue boxes, GetInAppPurchaseState() remains at 0 so app hangs.

Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 11th Oct 2016 14:36
I ran your attached APK on my Kindle Fire using the app tester app with the agk_free_entitlement product in the json file. The first purchase went successfully as you say, but force closing the app and restarting it successfully restored the purchase and showed it as available immediately. Here is the LogCat output from the restart of the app showing it getting the details of the purchases from the app tester.

Do you have access to the log for your device? In particular you are looking for the line "IAP Listener: Update: Restored ..." which happens in InAppPurchaseSetup()
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 11th Oct 2016 15:21
Log attached; dodgy bit here:


Test device is a Samsung S2 running Android 4.1.2

Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 11th Oct 2016 16:00 Edited at: 11th Oct 2016 16:00
Are you using the latest version of the Amazon test app located here https://www.amazon.co.uk/Amazon-App-Tester/dp/B00BN3YZM2? There was an old one that was distributed as a side loaded APK, but that doesn't work with the latest Amazon IAP commands.
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 11th Oct 2016 16:18 Edited at: 11th Oct 2016 16:22
Yep, latest version(3.0.10.2_3001310). I just tried the testIAP.agk on the Fire TV device with the same results - GetInAppPurchaseState() doesn't return 1 and doesn't return the Entitlement transaction shown as bought in the App Tester using GetInAppPurchaseAvailable(0). Log attached but I couldn't find any errors relating to IAP there.

Attachments

Login to view attachments
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 11th Oct 2016 17:55
Ok, I uninstalled the App Tester (v.3.0.10.2_3001310) from both devices and reinstalled it again from the Amazon website. Again v.3.0.10.2_3001310 and now GetInAppPurchaseAvailable() works! We need a headsmash against wall forum smiley. Something deep down in the previous install must have messed up, because I'd cleared the data and cache of that app a few times. But across two separate devices?!
Wilf
Valued Member
18
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 11th Oct 2016 23:03 Edited at: 11th Oct 2016 23:06
Ok, this looks like a bug in the Amazon App Tester. Uninstalling and reinstalling it changed all API Response Settings back to 'Default'; the bug came back when I set them all to 'SUCCESSFUL' again. Explains why both test devices displayed this behaviour after a fresh install.

Setting GetPurchaseUpdates API to 'Default' - which according to my understanding of the documentation should be synonymous with 'SUCCESSFUL' - allows GetInAppPurchaseState() to return 1 and GetInAppPurchaseAvailable(id) to return the current purchased state of the item. An AppGameKit Message box will state 'You have already purchased that item' if you try to buy it again.

Setting GetPurchaseUpdates API to 'SUCCESSFUL' or 'FAILED', and then trying to buy a previously bought item, after closing and restarting the AppGameKit app, will result in an Amazon dialogue box informing you of this and then a hang in the While GetInAppPurchaseState() loop as it does not return 1. GetInAppPurchaseAvailable(id) also returns 0 in this case, regardless of whether the item was actually purchased.

So to anyone else dealing with this issue, make sure your API response settings look like this:

Login to post a reply

Server time is: 2024-11-25 01:47:08
Your offset time is: 2024-11-25 01:47:08