GameSalad

Armelline's In-App Purchase Tutorial Template

ArmellineArmelline Posts: 4,340Member, PRO
edited November 2014 in Community Tutorials

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.

«13

Comments

  • Braydon_SFXBraydon_SFX Dallas, TexasPosts: 8,765Member, Sous Chef, PRO, Bowlboy Sidekick

    Awesome stuff man - thanks for sharing! Very kind of you!

  • SocksSocks London, UK.Posts: 12,324Member, BASIC

    Just brilliant ! I can't say I understand it all yet, but I'm glad someone does.

  • neomanneoman Posts: 811Member, PRO

    Thank you so much ... I will be checking this out for sure ... Cheers :smiley:

  • game+ongame on Sun Valley, California Posts: 79Member, PRO

    Armelline, looks good as always.

  • jorkosjorkos Posts: 347Member, PRO

    THANK YOU!!!!!!!!!!!!

  • ArmellineArmelline Posts: 4,340Member, PRO

    Glad everyone's enjoying it! I'll do an update with consumable purchases when I have the time!

  • ArmellineArmelline Posts: 4,340Member, PRO

    Doing something I normally hate, but bumping this for the weekend visitors!

  • robertkdalerobertkdale USAPosts: 912Member

    Thank you for sharing! :)

  • gamestudentgamestudent Posts: 503Member

    Woo Hoo!

  • iKandyiKandy Imagineer of Crazy Shit New York CityPosts: 310Member
    edited March 2015

    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.)

  • ArmellineArmelline Posts: 4,340Member, PRO

    @iKandy said:
    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.

  • jorkosjorkos Posts: 347Member, PRO

    Yes @Armelline using in Testflight is the best way to test iAP

  • As_Of_LatteAs_Of_Latte Posts: 343Member

    @Armelline Is this template still available? Wasn't able to download it from your site :/

  • ArmellineArmelline Posts: 4,340Member, PRO

    I broke all the links by mistake. I intend to update my site but haven't had time. Here is is in the meantime:

  • As_Of_LatteAs_Of_Latte Posts: 343Member

    @iKandy Did you ever figure out your issue...? I'm literally having the same problem after following the tutorial by @Armelline :neutral:

    This new IAP method is killing me...!

  • As_Of_LatteAs_Of_Latte Posts: 343Member

    @Armelline In my game, I have a "Shop" page setup up as follows:

    • Stars 250 ($0.99)
    • Stars 750 ($1.99)
    • Stars 2,000 ($2.99)

    • Remove Ads ($1.99)

    I also have a "Settings" page setup as follows:

    • Restore Purchases
    • Remove Ads ($1.99)

    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...

  • LovejoyLovejoy Posts: 2,078Member

    @As_Of_Latte said:

    You should only have one request purchase data behavior, thats all it takes to fill the purchase table.

  • ArmellineArmelline Posts: 4,340Member, PRO

    @As_Of_Latte said:
    Armelline In my game, I have a "Shop" page setup up as follows:
    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...

    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.

  • lotte205lotte205 Tallinn, EstoniaPosts: 41Member, PRO

    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?

  • ArmellineArmelline Posts: 4,340Member, PRO

    @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

  • lotte205lotte205 Tallinn, EstoniaPosts: 41Member, PRO

    @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.

  • ArmellineArmelline Posts: 4,340Member, PRO

    @lotte205 said:
    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.

    I was just forgetting the name of the attribute. Substitute "game.DisableAds" with "game.ItemPurchased".

  • sebmat86sebmat86 Posts: 339Member

    Man, this is a lifesaver! Im so grateful! Shut up and take my money!

  • ArmellineArmelline Posts: 4,340Member, PRO

    @sebmat86 said:
    Man, this is a lifesaver! Im so grateful! Shut up and take my money!

    Very much appreciated!

  • GreenfroggGamesGreenfroggGames Posts: 207Member, PRO

    Might be a stupid question but you're supposed to replace "item" with iap ID right?

  • ArmellineArmelline Posts: 4,340Member, PRO

    @GreenfroggGames said:
    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.

  • TomvnTomvn Posts: 47Member

    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.

  • lotte205lotte205 Tallinn, EstoniaPosts: 41Member, PRO

    @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?

  • ArmellineArmelline Posts: 4,340Member, PRO

    @lotte205 said:
    @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?

    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.

    @Tomvn said:
    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.

    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.

  • lotte205lotte205 Tallinn, EstoniaPosts: 41Member, PRO

    @Armelline Thank you again :) Hope you have the time to update the template too..

«13
Sign In or Register to comment.