New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct usage example #30
Comments
Thank you @rankorn |
Can anyone please hint me on what needs to be done in case there's no InAppPurchaseEvent.PURCHASE_SUCCESSFULL sent back from the store? Have tried everything available on these discussions to no avail. From the catLog it all seems to be starting or being called to start and no error or warning or debug hints on any problems... I'm out of tries please help! |
@ChrisGamePill as I said in another post, I personally moved to another ANE implementation: Pozrik's ANE is Android only, but it's API is more similar to the native in-app API. If you do move I can help you with an example that works. For iOS, I use Adobe's native extension. |
I'm listening to all these events
and later in my store_callback function, the purchase event can be checked.
I hope this is of some use. The other ANE looks interesting too! |
Since there is no documentation for this ANE, I will post how I made this work for Android and hopefully it will help others.
Application.xml:
The documentation says to add a service to the XML, but I have found this is wrong. You need to add an activity:
Next thing you need to do in your code is to initialize the service:
The GOOGLE_PLAY_LICENSE_KEY can be found in the Google play developer console under the Services & APIs section. NOTE: the initialization process is async, and for some reason freshplanet did not implement an event on initialization end. The only solution I have found is to make sure you wait enough time for the initialization to complete (bad bad practice.. but no good solution was found except to fork and add the event).
To make a purchase:
Everything is async so you have to add event listeners to receive success or error responses.
The InAppPurchaseEvent class holds a data property that is a JSON string with the information received from Google play. The content of the JSON is defined in the Google play in app purchases documentation.
For example, after you make a purchase you can extract the data like this:
Consuming products:
Where receipt is a JSON string that you get from Google play. This receipt is received right after you purchase or you can get it by querying the user's previous transactions.
More things to notice that will prevent problems
That's it, hope it helps, hope it's correct, comment if not.
The text was updated successfully, but these errors were encountered: