Armelline's In-App Purchase Tutorial Template



  • UncloudedStudioUncloudedStudio NetherlandsMember Posts: 285
    edited September 2016

    @Armelline Thank you for this tutorial! Do you have to load state of Ads on the very first scene or is it okay to use it inside the button?

  • ArmellineArmelline Member, PRO Posts: 5,112

    @UncloudedStudio said:
    @Armelline Thank you for this tutorial! Do you have to load state of Ads on the very first scene or is it okay to use it inside the button?

    You'll need to load it on the first scene, or else GameSalad doesn't know if it should show ads or not. Assuming that's what you're asking.

  • UncloudedStudioUncloudedStudio NetherlandsMember Posts: 285

    @Armelline Great, thanks!

  • ArmellineArmelline Member, PRO Posts: 5,112

    @loganjan22 said:
    @Armelline the buy button does not seem to work in test flight but the restore button does, meaning that a box pops up and asks for you apple password. Any ideas? Thanks

    I'd need way more info than that to offer suggestions, I'm afraid!

    Most common problem is forgetting to change the two game.Buying and game.Restoring attributes to false in the conditions of the touch rule. Booleans in GS default to true when added as conditions.

  • HymloeHymloe Member Posts: 1,653

    This is great, thanks @Armelline!

    I'm about to use the new IAP system for the first time, so I'm going to dig into this. Has anything changed in Game Salad - in how this all works - since this template was made? Or should it all still give an accurate guide to how IAPs work? :)

    Also, did anyone ever make a consumables example project? Assuming not, I'll check out the videos and documentation for further info. :) But thought I'd ask!

    All the best!

  • ArmellineArmelline Member, PRO Posts: 5,112

    Should still all be good! I've successfully used it every few weeks since it was made with no problems.

  • HymloeHymloe Member Posts: 1,653

    Great! I love it. I'll give it a go tomorrow. Thanks again!

  • ArmellineArmelline Member, PRO Posts: 5,112

    @Hymloe It needs very minimal editing to be used for consumables too. Just replace the saving of a boolean attribute like in the example with adding to an integer etc. and put a "Consume" behaviour in to be triggered once the integer has been updated. It's literally just a few behaviours different. At some point I'll get around to updating it to include that too!

  • HymloeHymloe Member Posts: 1,653
    edited February 2017

    How does one test IAPs using Test Flight?

    I can't figure out how to login as a Sandbox Test user.

    I've made a new Sandbox Tester user, and I want to be able to use them to test my IAPs in my Test Flight build.

    I'm finding that a Request Purchase Data just doesn't seem to work in my Test Flight build, and the Callback variable just sits on "0".

    (I should say, I am still using GS 0.13.34...
    Perhaps the IAP behaviours in that version of GS are out of date??)


    I've used @Armelline's template project for implementing my IAPs, and I think they're good to go.

    I've set up my IAPs in iTunes Connect, even with screenshot and test account info provided for Apple.

    However, I haven't Submitted the IAPs to Apple (the Submit button remains greyed out for me, even though it says they're ready for submitting. I figure I have to wait until I actually submit a build to the store).

    I've uploaded a Test Flight build, but when I download it, it never asks me to login as a test user.

    I have a "Request Purchase Data" behaviour that it does right when the game loads, but the callback always stays on 0 (as shown by a Display Text output I'm using to show the status).

    Do I need to Submit the IAPs to Apple before they can even be tested?

    Should the game ask me to login using a Test Account when my game performs a Request Purchase Data, or an IAP - Buy Item behaviour?

    Do I have to send out an External Test build, or can I just use an Internal Test build? (I'm really hoping I can just use an Internal one as that's all I have been using up to now).

    Does it make sense that, if I haven't logged in as a Sandbox Tester, that my Request Purchase Data behaviours won't even be doing anything? I would have thought they'd be coming back as Callback "-1" if they're not working, but currently, they don't seem to be triggering at all, so I just always see Callback "0".


  • HymloeHymloe Member Posts: 1,653
    edited February 2017


  • ArmellineArmelline Member, PRO Posts: 5,112
    edited February 2017

    Did you sign the necessary agreements? It used to be that Apple wouldn't even let you add an IAP until you did, but now they let you and it just does nothing. No request purchase data return.

    There's no need for a sandbox tester account for IAP if you've set it all up correctly.

  • HymloeHymloe Member Posts: 1,653

    OK, I'll look into that stuff. Thanks!

  • HymloeHymloe Member Posts: 1,653
    edited February 2017

    I went through this Apple website, explaining the process in more detail...

    And realised that it says that you SHOULDN'T upload an image for the IAP, so that iTunes Connect still says "Missing Metadata".

    So I've changed that (I deleted the images, so it says "Missing Metadata" again.)

    The info page also gives examples of Product IDs in the format:

    I have mine just in the format "coin200". Is that wrong? Do I need to have the full com.companyname.gamename thing before it, in the Product ID?

    I don't remember seeing that in the documentation I was working off!?

    Mine look like this? Is that a problem?

  • HymloeHymloe Member Posts: 1,653
    edited February 2017

    Everything else at my end seems fine.

    I have a current "Paid Applications" agreement for All Regions, effective as of Nov 30, 2016. (Is that too old perhaps?)

    In the Apple Developer website, I have my app's In-App Purchase feature enabled...

    And my IAPs seem to be set up correctly in iTunes Connect.

    Any advice would be much appreciated.

  • ArmellineArmelline Member, PRO Posts: 5,112

    If you not even getting a Request Purchase Data response and you're testing via TestFlight, have signed all agreements, and definitely have the same Purchase ID in all three necessary places, then I'm afraid I'm out of ideas. Have you confirmed that the Request Purchase Data is actually being triggered? Put one in a button with nothing other than a Touch is Pressed and monitor the result.

  • HymloeHymloe Member Posts: 1,653

    This thread suggests the naming doesn't require a reverse DNS style name...

    So I don't think that's the problem.

  • HymloeHymloe Member Posts: 1,653
    edited February 2017

    I'll try naming them with the reverse DNS naming convention, and see if that helps.

    Any other suggestions would be a great help. :)

  • ArmellineArmelline Member, PRO Posts: 5,112

    @Hymloe said:
    This thread suggests the naming doesn't require a reverse DNS style name...

    So I don't think that's the problem.

    I've never done it. Might be recommended but certainly isn't necessary.

  • HymloeHymloe Member Posts: 1,653

    OK, thanks @Armelline!

    I'll try the simple button for "Request Purchase Data".

  • HymloeHymloe Member Posts: 1,653

    When you do a Request Purchase Data in the VIEWER, is it normal for nothing to happen?

    In my version of GS, when you click BUY in your template, it doesn't do anything until I click on Callback "1", then it pops up a message saying, "IAP BUY not supported in Viewer".

    All as expected.

    Or for you people with newer versions of GS, does it also say "Request Purchase Data not supported in viewer"?

    Or does a "Request Purchase Data" just fail silently when in the viewer?

  • ArmellineArmelline Member, PRO Posts: 5,112

    You need to push via TestFlight or push an ad hoc and use a testing account to test IAP stuff. I strongly recommend TestFlight. Request Purchase Data will do nothing in Viewer (or Creator).

  • HymloeHymloe Member Posts: 1,653

    It says you need to make a new VERSION if your app before you can add IAPs, but I wasn't sure whether I need to do this while the game is still in testing, unreleased.

    I've been incrementing the Build, but not the Version.

    I'll try updating my game from version 0.7 to 0.8, and that might help, too.

  • HymloeHymloe Member Posts: 1,653

    Does one need to submit new In App Purchases through Application Loader?

    I see there is a way to do it, by the looks of it. But is this step needed, or is this covered by just adding them to iTunes Connect and such?

  • ArmellineArmelline Member, PRO Posts: 5,112

    You can ignore everything about new versions until you're pushing it to the app store. The first time you submit IAP, you have to submit it with a new version of the app (normally the first, but you might be adding it later). After that you can update IAPs without submitting a new version. None of that pertains to you right now, though.

    You don't submit new IAPs through Application Loader, but you do need to upload your app through it to test with TestFlight.

    Your steps are these:

    1. Add IAPs in iTunes Connect (you've done this already by the looks of it).
    2. Upload your game using Application Loader and an App Store provisioning profile.
    3. Add the build to TestFlight.
    4. Test.

    It sounds like you're focusing too much on the IAP aspect and not enough on the actual getting a version on TestFlight to test part. Did you test the Request Purchase Data in a button on its own in a version you uploaded and tested with TestFlight?

  • HymloeHymloe Member Posts: 1,653

    Thanks for all the very clear answers! I'm still not sure why it's not working for me.

    I've been testing with Test Flight (internal testers) for the last few months. That process is working fine.

    I uploaded a new build for Test Flight just now, with version 0.8 instead of 0.7.

    It isn't working any better.

    I added a button on the main menu that just does this...

    I tap that button, but I get no change in my Callback attribute, and the table cell 5 of row 1 of Purchase Table never has anything in it (judging from my Display Text function on the main menu).

    All I can really think is that my version of Game Salad is too old (0.13.34), and the IAP behaviours have changed, or something?

    Or that I'm using iOS 9.3.1.

    By the way, my PurchaseTable looks like this...

    I'm just not getting the callback, and my PurchaseTable is not getting filled.

  • ArmellineArmelline Member, PRO Posts: 5,112

    Did you choose to host content with Apple when setting up the IAPs?

  • HymloeHymloe Member Posts: 1,653

    I'm trying the new Game Salad now, and I think it's gonna work.

    In the viewer, when the game performs a "Request Purchase Data" it now pops up saying "IAP behaviours are not supported in the Viewer", whereas it wasn't even donig that in GS 0.13.34.

    So, I feel like that behaviour just wasn't working, and now, hopefully it will!


  • HymloeHymloe Member Posts: 1,653

    Yep, apologies for (I guess) wasting everyone's time.

    I'm using the latest GS, and it all works fine. Apologies!

    I guess the "Request Purchase Data" behaviour in GS 0.13.34 just wasn't working any more.

    Thanks so much for the help @Armelline!

  • ArmellineArmelline Member, PRO Posts: 5,112

    Glad you got it working!

  • HymloeHymloe Member Posts: 1,653

    With Restore Purchases, is the expectation simply to restore any non-consumable IAPs, and any consumable purchases that they've made are lost if they have uninstalled the app, for example?

    Also, once you restore purchases, what does the resulting Purchase Data look like? Would the Status cell of a non-consumable IAP say "Purchased"?

    Like, if you had 5 different non-consumable IAPs, and the player had bought 3 of them, then deleted the game, then re-installed it, then hit Restore, what would the table look like once it had been successfully filled?

    Would it say "Purchased" in the Status cell of the 3 items they had bought?

    And would the developer therefore check each Status cell, and update their in-game attributes to reflect those, and then save them?

Sign In or Register to comment.