Armelline's In-App Purchase Tutorial Template
I finally got around to finishing this off.
The new IAP system in GameSalad is powerful but confusing. You can see some musing regarding it that I posted before in this thread, as well as a handy flow-chart type thing.
What I want to share today is what I'm calling a Tutorial Template that walks you through setting up a non-consumable IAP with dynamic button updating. Apple are keen to get people doing this, and it adds an extra bit of polish to your game.
Included too is a way of testing your IAP within the Creator. Frustratingly, GameSalad doesn't give you a way to simulate the return of the Request Purchase Data or Purchase Item behaviours, but this template shows you a really easy way to approximate this behaviour.
This video will show you what I'm talking about:
I chose in this example to only trigger the filling of the PurchaseTable when the user actually requests a purchase. My experience has been that trying to fill it before a purchase is requested can lead to the user getting popups requesting they log in. I have a strong preference to avoid that happening. Depending on the complexity of your shop, though, you might want to make that concession.
You can find the template to download at my website. Click here to jump straight to it, or click here to visit the homepage.
This template is completely free and I hope it helps some people figure this IAP stuff out! Should you wish to donate a dollar or five towards me making more free templates like this, there's a link on my page - but doing so is 100% voluntary.
Enjoy!
Strictly no inclusion of logic from this template is allowed in any commercial template.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Comments
Awesome stuff man - thanks for sharing! Very kind of you!
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Just brilliant ! I can't say I understand it all yet, but I'm glad someone does.
Thank you so much ... I will be checking this out for sure ... Cheers
Free Mini Games and Demo Templates
Armelline, looks good as always.
THANK YOU!!!!!!!!!!!!
Glad everyone's enjoying it! I'll do an update with consumable purchases when I have the time!
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Doing something I normally hate, but bumping this for the weekend visitors!
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Thank you for sharing!
Big Smile Games Play Happy!
Check out our other GameSalad exclusives.
Woo Hoo!
Armeline, you mentioned in a GS Workshop that this method doesn't work in an adhoc. Could you clarify this? I've been trying to use your method and have been having a LOT of difficulty. When testing in either adhoc or testflight versions-- if the Apple server detects that the app has been previously purchased (in sandbox,) it throws the entire mechanism out of whack. (asking me to keep inputting my password over and over as well as going through the various purchase windows, over and over. It also keeps generating 1,0 in the callback attribute and purchased, pending and unpurchased in the table.)
My experience was that when I put games on my phone via Xcode, the IAP didn't work, but when I used Apple's TestFlight, they did. I'm not sure exactly what the restrictions are though.
It sounds like you may have a problem in your IAP logic, though.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Yes @Armelline using in Testflight is the best way to test iAP
@Armelline Is this template still available? Wasn't able to download it from your site
I broke all the links by mistake. I intend to update my site but haven't had time. Here is is in the meantime:
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@iKandy Did you ever figure out your issue...? I'm literally having the same problem after following the tutorial by @Armelline
This new IAP method is killing me...!
@Armelline In my game, I have a "Shop" page setup up as follows:
Stars 2,000 ($2.99)
Remove Ads ($1.99)
I also have a "Settings" page setup as follows:
I'm having the same issue as @iKandy where I am prompted to input my password over and over, as well making a purchase only to be followed up with several purchase windows for my other IAP's...even though I did not press their buttons.
Any ideas what is going on?
Could it be I need to remove the "purchase request data" from all but one actor? I'm confused as to why I try making one purchase but then several purchases windows are fired right after...
You should only have one request purchase data behavior, thats all it takes to fill the purchase table.
Fortuna Infortuna Forti Una
It sounds like you're triggering something repeatedly when you're not. I'm afraid IAP issues are very difficult to troubleshoot by description alone. I'd recommend creating a new thread and posting screenshots of ALL the logic you use for your IAP.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I'm making my first game and it's a little confusing. When I have this logic in my game, then do I have to put Show Banner behaviour in a rule and what kind of rule? For example When any attribute: buying, restoring and item_purchased is false then show ads?
My games:
Who's Behind the Gates
Flip Happy
@lotte205 I'm assuming you're mentioning show banner behaviours because you're using the in-app purchase to disable ads in the game?
If so, you'll use the IAP logic to change a game attribute (or table cell) from true to false/0 to 1 when the purchase is confirmed. e.g. "Change attribute game.Disable Ads to true"
Then you put your ads in a rule that says something like:
When game.Disable Ads is false
Show banner ad
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline Thank you for your quick reply. Unfortunately I really don't understand why the extra attribute "game.DisableAds"? In your template wouldn't it be "When game.ItemPurchased is false, then show banner"? And if you need the attribute game.DisableAds how do I use the IAP logic to change this attribute and where do I even put it? It would've been so much easier if you had the example show banner behaviour in your template But I really appreciate your work, the template is great and very detailed.
My games:
Who's Behind the Gates
Flip Happy
I was just forgetting the name of the attribute. Substitute "game.DisableAds" with "game.ItemPurchased".
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Man, this is a lifesaver! Im so grateful! Shut up and take my money!
Very much appreciated!
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Might be a stupid question but you're supposed to replace "item" with iap ID right?
Yes - both in the "Buy Item" behaviour and in the PurchaseTable.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Armelline .
I try your code is work great , but put to my game is nothing happen.
i got a button Buy coins with the Buy Coins attribute. integer , I use that instead Item.purchase attribute in boolean . Could you please make little more help on that?
Thank you.
@Armelline I would now like to try consumable IAP. Do you have a template for that? If not, what's especially important to notice when adapting the non-consumable template?
My games:
Who's Behind the Gates
Flip Happy
The only significant difference if you need to add the "Consume item" behaviour once you've confirmed the purchase has gone through. I let my develop account lapse a while ago as I had no specific need for it, but I'll need to re-enable it soon to test some IAP work for a client, so I'll see about adding consumable to the template when I do.
Sorry @Tomvn I didn't see your message here. I'm afraid I'd need a lot more detail than that. It could be one of a hundred things going wrong.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline Thank you again Hope you have the time to update the template too..
My games:
Who's Behind the Gates
Flip Happy