06 April 2016
Amazon In-App Purchasing v2 plugin now available
Corona Labs is pleased to announce the immediate availability of the Amazon IAP v2 plugin. If you plan to deploy your app to Amazon Kindle devices and use their in-app purchasing (IAP) service, you should implement this plugin within your projects as soon as possible. Additionally, if you currently have an app in the Amazon Appstore that uses their IAP service, it must be updated to the v2 plugin before April 30, 2016.
Implementing the new plugin
The plugin is pre-activated in the store for you. Because this is an official Corona Labs plugin, you need to change your build.settings
file to reflect a different publisherId
. The plugin name remains the same, but publisherId
must be changed to "com.coronalabs"
:
1 2 3 4 5 6 7 8 9 10 11 12 |
settings = { plugins = { ["plugin.amazon.iap"] = { publisherId = "com.coronalabs", supportedPlatforms = { ["android-kindle"]=true } }, }, } |
New functions and properties
This updated plugin includes a few additional functions and properties in comparison to the legacy plugin:
- store.isActive is now supported. This property will be
true
if the plugin was initialized successfully. You can use this as the sole point of confirmation that other store functions and processes can be initiated. - New store.getUserData() function added to retrieve the user ID and marketplace code of the currently logged-in user.
- New properties available in the productList event table associated with store.loadProducts(), as well as the storeTransaction event table associated with initialization, purchase, and restore requests.
Transaction changes
In addition to the new functions and properties above, some important changes have been made in the v2 plugin:
- Amazon now requires that you “finalize” all transactions. Thus, you must now call store.finishTransaction() following every transaction to notify Amazon about the transaction being processed.
- Amazon IAP v2 does not include a
"restored"
state for transactions. The store.restore() function can still be called to retrieve all of the user’s purchases, but now all valid transactions will be of the"purchased"
state.
Migration guide
All of the above points are summarized in our migration guide which will assist users of the legacy plugin in updating to the new plugin.
Documentation
As always, we provide comprehensive documentation for this plugin. Both users of the legacy plugin and new users are encouraged to consult this documentation in order to successfully implement Amazon In-App Purchasing.
In summary
Remember, Amazon requires that all apps utilizing their in-app purchasing service are upgraded to v2 before April 30, 2016. If you have further questions, please discuss them in the Corona forums.
Scott
Posted at 09:41h, 06 AprilI don’t see it on the store, is the same plugin as before?
Rob Miracle
Posted at 09:45h, 06 AprilThe code you put in build.settings is different, but we’ve hidden the old version in the store. The new version points to the new plugin and new docs.
Scott
Posted at 18:59h, 06 AprilRob sorry for telling you here, I submit a bug 5 day ago. Still have not heard back. I think it is a pretty big with text fields(not text boxes) and they won’t return a began phase with a listener. I know it is off topic but thought you guys should know.
Rob Miracle
Posted at 19:41h, 06 AprilYou should have gotten a email from the bug tracker. You can reply to that email to find out. Also you can ask in the forums in a more on-topic place and ask about the bug and I can look it up.
Scott
Posted at 20:53h, 06 AprilOk, I will reply
Number is 45529
Andriy
Posted at 14:42h, 07 AprilDoes new plugin support “store.canLoadProducts” and “store.canMakePurchases” properties?
Rob Miracle
Posted at 19:27h, 07 AprilAmazon IAP V2 does not support these, but we added convenience methods of the same name that just run true so you can continue to use them.
Andriy
Posted at 05:57h, 08 AprilThank you, Rob
Evan
Posted at 12:54h, 11 AprilWhen cancelling an iap, I’m finding a long delay on my device before the callback function gets called. It does eventually get called with an errorType and errorString of FAILED and FAILED. Any more information on this? Ideally it wouldn’t take 5-10 seconds and the transaction.state would == ‘cancelled’.
Thoughts?
Rob Miracle
Posted at 13:43h, 12 AprilIt could take that long.
George
Posted at 14:15h, 11 AprilHi Rob, from where should I call finishTransaction? From within the transaction event handler? An example would have been very helpful. Thanks!
Rob Miracle
Posted at 13:42h, 12 AprilIf you’re using the typical transactionHandler() function that we use in our documentation and in the tutorial, in side that function you will have a big if-then-elseif-elseif-else-end statement where you test to see if you got transaction.state == “purchased” etc. You can call finishTransaction after each of these, or simply put it at the end of the function if your logic lets it flow to the bottom. See the example code here: https://docs.coronalabs.com/daily/guide/monetization/IAP/index.html#transaction-listener
Stany2011
Posted at 04:08h, 12 AprilHi, can you tell me what kind of permissions i have to add for useing the amazon iap plugin?
Rob Miracle
Posted at 13:39h, 12 AprilOur plugins add the required permissions themselves. You don’t need to add anything special.