<font size="3">EDIT:
<font color="orange">IT'S ALIVE!</font>... Below is the list of things you'll need to do to get IAP working on iOS CocoonJS (I only assume this works for Android too). Will wrap this all up into a nicer tutorial when I have some spare time. But for the moment for anyone else tring to get IAP use this checklist as a starting point</font>
- Construct 2 r123.2 or later (this has the crucial update to enable the CocoonJS's IAP Store) <img src="smileys/smiley20.gif" border="0" align="middle">
- Apple Developer Account <img src="smileys/smiley20.gif" border="0" align="middle">
- App ID set-up with Bundle ID: com.appname <img src="smileys/smiley20.gif" border="0" align="middle">
- App ID IAP Configured and Enabled <img src="smileys/smiley20.gif" border="0" align="middle">
- App Provision set-up with App ID & Device UDID <img src="smileys/smiley20.gif" border="0" align="middle">
- IAP set-up with App ID with Product ID: com.appname.premium (for c2) <img src="smileys/smiley20.gif" border="0" align="middle">
- IAP added to App <img src="smileys/smiley20.gif" border="0" align="middle">
- Test Account created for IAP testing (needs to be a unique ID and valid email) <img src="smileys/smiley20.gif" border="0" align="middle">
- My current App status is "Prepare for Upload" <img src="smileys/smiley20.gif" border="0" align="middle">
- Xcode set-up with devices as developer <img src="smileys/smiley20.gif" border="0" align="middle">
- Device is signed out of App Store <img src="smileys/smiley20.gif" border="0" align="middle">
- Premium CocoonJS Account - Either fill form or send email asking for it. It's free atm and does take a couple of days <img src="smileys/smiley20.gif" border="0" align="middle">
- Once you have Premium Account, enable Store in Extension on cloud compiler <img src="smileys/smiley20.gif" border="0" align="middle">
- In In-App Purchases (once you've enable store above) in configuration put you IOS Share Secret Key and Tick Sandbox mode for TESTING.<img src="smileys/smiley20.gif" border="0" align="middle">
- Add your Product to the Available Products (same ID as the ones set-up on Apple/Google i.e. com.appname.premium), these are for testing. <img src="smileys/smiley20.gif" border="0" align="middle">
- CocoonJS cloud compiler set-up to build xCode projects (All iOs assets and Bundle ID same as App ID) <img src="smileys/smiley20.gif" border="0" align="middle">
- xcode and Mac set-up with provision profiles and certificates allowing CocoonJS build to compile and run to device (sandbox mode) <img src="smileys/smiley20.gif" border="0" align="middle">
- Have the following Construct 2 events:
var Global text IAP1 = "YOUR IAP ID i.e. com.appname.premium"
On Start of layout
CocoonJSAds Is In CocoonJS
ConcoonJSAds Is Store available
ConcoonJSAds Is product IAP1 purchased | Set Premium to 1
Touch | On touched "MY BUTTON" | Call "Premium" //Can attach this action to as many call to action objects
Function on "Premium"
CocoonJSAds Is In CocoonJS
ConcoonJSAds Is Store available
ConcoonJSAds Is product IAP1 purchased | Set Premium to 1 & ConcoonJSAds Restore Purchases
else | CocoonJSAds | Purchase product IAP1 with preview
CocoonJSAds On IAP1 purchase complete | Set Premium to 1
CocoonJSAds On IAP1 purchase failed | ChromeConsole | "Failed" //Could put a popup to tell user the IAP failed
Still trying to work out Restoring Purchases as this doesn't seem to work (call it on load to update assets).
I'm also having troubles removing/resetting the IAP. Tried to remove the purchase from the Purchased Transaction on CocoonJS cloud settings but the system still think's the IAP is purchased (also tried rebuilding after removing transaction). Might have to make another test account.