Cocoon.io with IAP

Discussion and feedback on Construct 2

Post » Sun Jun 04, 2017 9:17 pm

The built in IAP object lists Coocon.js as a compatible platform here https://www.scirra.com/manual/173/iap. Is this still working with Cocoon.io? I'm having trouble with the Cranberry Cordova IAP plugin not firing the purchase product action and I'm trying to find another IAP solution.
B
51
S
18
G
2
Posts: 111
Reputation: 4,611

Post » Mon Jun 05, 2017 3:09 am

After looking around I see some people have the Cranberry IAP working but all the posts I see are using XDK and exporting to Android. Here is how I have my things set up.

Splash screen
On Start of layout>
CordovaIAP>Add product IDs "removeads"
CordovaIAP>Request store listing

Main Menu
On touch(remove ads button)>Purchase product "removeads"
On touch(restore purchases button)>
CordovaIAP>Request store listing
CordovaIAP>Restore purchases

Game is compiled in Cocoon.io, config.xml is setup correctly all plugins match installed plugins in Cocoon. Got everything set up correctly in Xcode(provisions, bundle ids, certificates, etc), IAP is set up correctly in iTunes Connect and enabled for the app. I build a development build and deploy it straight to iOS device. I'm getting nothing happening at all when I click on the buy remove ads button, the restore purchases give me a prompt to sign in(which i would sign in using my sandbox account if i actually had the purchases working). Not sure why I'm getting nothing on buy button with Purchase product action on it. Not sure if I have my events set up wrong, if it's something with the plugin or what. Anybody that has any advice would greatly be appreciated, @Artpunk , @AndreasR , @cranberrygame . Thanks.
B
51
S
18
G
2
Posts: 111
Reputation: 4,611

Post » Mon Jun 05, 2017 4:21 am

You can use the Cocoon inapp Plugin,
https://shatter-box.com/knowledgebase/c ... he-plugins

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
106
S
39
G
31
Posts: 1,170
Reputation: 29,229

Post » Tue Jun 06, 2017 10:15 am

Hey @twg

I have Cranberrygame's Cordova iAP working on Android and iOS at the moment. But like you say the game was built with XDK not Cocoon.

I am currently in the process of migrating the same game from XDK to Cocoon and decided I would also swap from Cranberry's plugins to Cocoon's own plugins for iAP and GooglePlay / GameCenter.

So at this stage I can tell you that I have Cocoon's iAP plugin working for Android, but I haven't tested for iOS. In Android, the purchasing events, restore purchase events, and conditions for checking purchases all seem to work. Ill be testing iOS in the next few days, so ill be able to comment on Cocoon iAP on that platform soon.

I tried to use the Cocoon iAP plugin in exactly the same way as I used Cordova iAP. When the game first loads up and the title screen is showing, check if the remove ads iAP has been purchased and if so restore the purchase.

On Start of Layout
>Cocoon InApps - Fetch products from Store "removeads"
>Cocoon In Apps - Update product list

On Products Fetch completed
>Restore purchase

The events I use for purchasing the iAP are:

On Touched 'Remove Ads button'
>Cocoon InApps - Purchase product "removeads"

If purchase successful
>Hide the remove ads button
>Store a value in a dictionary, which is later used to disable Ads in game. This value is store in localstorage.

Events linked to restore button for restoring purchase are same as events in the title screen but use 'On Touched "Restore Button"' rather than On Start of Layout. Hope that makes sense?

A super useful trick that @AndreasR showed me is how to use the consume purchase action to remove the purchased iAP from the game. That way you can test the iAP works multiple times.

Add a sprite to the menu screen, with events:

On Touched > Consume "Remove Ads" iap

Now you can purchase the iAP again. One difference I noticed between CordovaiAP and Cocoon iAP is that the 'On Consumed' condition doesn't seem to fire for Cocoon's iAP (but does work for Cordova iAP).

@twg Hope that helps, sorry for wall of text. Let me know if you get it working on iOS, like I say Ill be battling iOS myself over coming days. So I can give better information once Ive got it working.

Oh one other thing I wanted to say. You mentioned in your post about having a sandbox account. I never managed to figure out wtf the sandbox account was all about. I never managed to use it. I use the 'Internal Testers' section in iTunesConnect to test pre-release builds of my game for iOS.
B
74
S
52
G
62
Posts: 406
Reputation: 39,080

Post » Tue Jun 06, 2017 2:13 pm

@Artpunk I haven't had any problems Cranberry plugins I'm using(NativeShare & Leaderboards) with my iOS Cocoon builds, I put the Cocoon dev app on the device yesterday with some debugging stuff in there and realized that the Fetch product list is failing every time(using CocoonIAP). After looking around I realized that one of my billing agreements required to have IAP in my games is pending and if it's not accepted Apple won't let your app access the IAP. My events are pretty much the same way yours are, so I think this is why my IAP isn't working right now. Gotta wait till they get back to me about that before I can test some more.

The sandbox accounts are really helpful, really easy to test IAP with, just gotta set up a new sandbox account in your users and roles, only thing is it has to be a new email that is not your developer email account or an email account associated with any of your current tester or itunes connect user accounts. Just log out of the app store on your device, deploy the build to it then when you click an IAP it will ask you to sign in and you just use the sandbox account login. Just make you don't go into settings>App store and use your sandbox login there cause it will turn the sandbox account into a regular account.
B
51
S
18
G
2
Posts: 111
Reputation: 4,611

Post » Thu Jun 08, 2017 7:43 pm

@Artpunk

Could you please help me on this?

https://forums.cocoon.io/t/need-help-wi ... n-iap/5537

Thanks.
B
24
S
7
Posts: 337
Reputation: 2,224

Post » Fri Jun 09, 2017 3:05 am

Hi @sudeep98 I replied on the cocoon forum.
B
74
S
52
G
62
Posts: 406
Reputation: 39,080


Return to Construct 2 General

Who is online

Users browsing this forum: dop2000 and 4 guests