OUYA In App Purchases with OpenFL
Java Haxe Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


OUYA In App Purchases with OpenFL

A simple example that shows how to get the product list, receipts and purchase a product.



What the current example does:

  • fetch the test product information and receipts
  • display a large O icon, unless you have purchased the test product
  • press any OUYA controller button to purchase the product
  • hide the O icon on successful purchase

There are no other visuals, you'll have to watch the console output using 'adb logcat'.

Getting started:

You will need:

Enter the above mentioned into the Main.hx.

The latest version of openfl/openfl-native is missing the "createInterface" method - I guess jgranick had it in his working copy but did not push to the repo. As a temporary solution, you will have to comment out every reference to "createInterface" within "C:\HaxeToolkit\haxe\lib\openfl-ouya/1,0,2/tv/ouya/console/api/OuyaResponseListener.hx" or any other class using it.

IAPHandler.hx class defines multiple callback methods (onProductListReceived, onPurchaseSuccess, etc.). Subclass it and override the methods with your own handlers. One such example subclass is a MyIAPHandler.hx.

The JNI bindings are contained within a src\java\com\jarnik\iaptest\OUYA_IAP.java class. It's mostly a copy-pasted "iap-sample-app" from the ODK.


My Java and JNI knowledge is fairly limited, so please don't hesitate to contribute with better methods. The openfl-ouya contains some part of ODK IAP API, but I couldn't get it to work, so I made this crude wrapper.