Purchase Table

FireCrocFireCroc Member, PRO Posts: 60

I have created a game and uploaded to the playstore. I have an IAP that when bought unlocks the full game. When I make the purchase on the playstore the item successfully purchased on the store, but in my game it is not reflecting that it is bought.

I think the problem I am having is that I am not reading the "PurchaseTable" correctly. When the item is bought on the playstore the 'change table' and 'change scene' is not triggered in my game. This is my logic


Please help.

«1

Comments

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 251

    Hi there! can you post a copy of your table 'tblDidUserBuy' ?

    GameSalad Templates and Custom Development at the Official Marketplace: http://gshelper.com

  • FireCrocFireCroc Member, PRO Posts: 60
    edited February 2023

    Hi uptimistik

    Thanks for your reply. This is the table


    and also it doesn't trigger the 'change scene' after the purchase was made

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 251

    Can you try using the value '1' instead of true and '0' instead of false? Also, I've had success using Integer columns and the values '1' and '0' (instead of booleans)

    GameSalad Templates and Custom Development at the Official Marketplace: http://gshelper.com

  • ArmellineArmelline Member, PRO Posts: 5,316
    edited February 2023

    Also be sure to put the scene change in a short timer (with run to completion checked), perhaps 0.05s. You want to make sure it has time to record the table change and save the table change before changing scenes.

  • FireCrocFireCroc Member, PRO Posts: 60

    Thanks for this Uptimistik and Armelline, I am going to give this a try.

  • FireCrocFireCroc Member, PRO Posts: 60

    Hi Armelline and Uptimistik,

    Sorry for the delayed response. I only managed to do some testing now. I tried changing the Boolean in the table to read as 1 or 0 instead of true and false and I also put a timer in the change scene menu, this did not work.

    To me it seems that the purchase table "State" field does not get populated with the word 'purchased' so the events under the Purchased condition are not getting triggered

    Maybe I should retry recreating my purchase button

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 251

    Manually set the value of the cell to 'purchased' and see if that triggers the events in the game.

    GameSalad Templates and Custom Development at the Official Marketplace: http://gshelper.com

  • ArmellineArmelline Member, PRO Posts: 5,316

    What @uptimistik said. Whenever I add IAPs to a game, I always have two debug actors. One that gives me buttons to set the purchase table unpurchased/pending/purchased and one to set the callback attribute to -1/0/1. Lets me do the first stage of testing before upload, and a button to set the table to purchased will let you identify if the problem is elsewhere in the code like @uptimistik suggests might be the case. If you want to send your project file over to me I'm also happy to take a quick look and see if the problem is anything obvious.

  • FireCrocFireCroc Member, PRO Posts: 60

    Yes, I have created a test button that when pressed, updates the purchase table (column 5) to "purchased". This does trigger the rest of the events

    Armeline, thanks for the offer to check. Let me DM you.

  • FireCrocFireCroc Member, PRO Posts: 60

    Hi Armelline,

    When you have a few minutes please check your mail I have sent you an email with project files

  • ArmellineArmelline Member, PRO Posts: 5,316

    Sorry, it ended up in my junk! Taking a look now.

  • ArmellineArmelline Member, PRO Posts: 5,316

    I've taken a quick look at the project file. There are definitely a few things you can do to clean things up (like not using two different callback attributes, and not storing the purchase confirmation in both a table and an attribute) but it... seems to work okay. When I pass the callback attribute and the purchase table the values they're looking for, the purchase completes and the scene unpauses.

    This makes me think your problem might be outside the project. The clues were in your first post, I just missed them.

    Do you have your tax information added to Appstore Connect and all your agreements signed (specifically the paid applications agreement)? If not, Apple just ignore all in-app purchase requests. They'll just return nothing, not a "pending" and not an "unpurchased". You mentioned it working on Google, so best bet right now is that you have an issue with one of your Apple agreements.

  • FireCrocFireCroc Member, PRO Posts: 60

    Thanks for taking time to look at it and your feedback.

    Sorry for the misunderstanding. This is only for Google play store and not Apple. When the 'Buy' button is pressed. The purchase goes through on the Google Play store, but this does not reflect in the game. In the game after the purchase went through on the Google Play store, all the levels are still locked. The events under the procedure that checks for the "purchase" state does not fire.

    Hope this explanation makes sense🙂

  • ArmellineArmelline Member, PRO Posts: 5,316

    Sounds like a test needs to be done with some debug information showing then, as it reacts exactly as expected when I trigger a fake purchase in game. I'll send you an edited project file to try out, but it will probably be tomorrow.

  • FireCrocFireCroc Member, PRO Posts: 60
    edited March 2023

    So I tried debugging and included on my buy page 2 variables. The first one is a game variable to check if the item is bought. If it is bought it is set to true if it is not bought it is set to false. The 2nd variable is column 5 of the purchase table.

    Before purchase the variable looks like this

    Once I click the Buy button. The item is bought successfully,

    This is the state of the variable after buy

    The purchase table is set to pending. Looks like the Purchase table does not get updated with the word "purchased"


    maybe I should add to my debug list a 'call back' variable to check the status of this.

    Also I noticed after a successful purchase the money from this item gets refunded back into my account after a few days.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,006
    edited March 2023

    Is this item a consumable? If so, you need to manually "consume" it. If not, then I'll need to dig into some code.

  • FireCrocFireCroc Member, PRO Posts: 60

    Hi Adent42,

    Sorry, but unfortunately its a non consumable. This is used to unlock the full game. Bellow are the events that are not triggered.


  • ArmellineArmelline Member, PRO Posts: 5,316

    Sorry, I got totally sidetracked. This seems to be an issue outside the logic, but I recently did an Android IAP without issue, so it probably isn't a widespread issue. I looked at the logic in your problem again, and the only thing I can suggest is to make sure that second Request Purchase Data in the GamePrice actor is disabled, and you stick to the one in the Buy button (though you can have it trigger immediately).

    What I would try next would be a project file with just an actor that, when pressed, triggers the purchase. Same ID as in your table. No other logic, just touch is pressed and Buy Item inside, along with a display text to display tableCellValue(purchasetable,1,5) like you have in your screenshots above.

    Basically, rule out everything related to your project logic, and confirm it is indeed never reaching a "purchased" state even with absolutely nothing to interfere. If it still says "pending", then you'll definitely need to continue this with @adent42 as it's likely GS related. If it triggers "purchased" then perhaps you and I can troubleshoot it over Skype.

    Third option is that there's an error in your Play Store setup. Double and triple check everything there.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,006

    @FireCroc are you using the RC or the regular build?

  • FireCrocFireCroc Member, PRO Posts: 60

    @adent42 I use the "Build RC" Button

    @Armelline Thanks, let me give this a try. Will let you know how it goes

  • FireCrocFireCroc Member, PRO Posts: 60

    Hi Adent42 and Armelline,

    I tried as you suggested and till no luck🙁 I have made changes and uploaded a new game

    The only logic I have now for the buy button is

    When I do the purchase. The payment successfully goes through on Google Playstore but the purchase events is never triggered.

    On my debug textbox the Purchase table field 5 changes from "unpurchased" to pending. Same like the screenshots I uploaded earlier

  • ArmellineArmelline Member, PRO Posts: 5,316

    If you're not getting past "pending' with purchase logic that simple, the problem is definitely either in your Play Store setup or on GS's side. (I'd avoid putting the succeeded logic in an otherwise like that, but if you're never getting past "pending" it's moot for now.) I'd be inclined to think the Play Store side, since I did a successful Google IAP a few weeks ago. Are you absolutely positive everything is set up correctly on the store end of things?

  • FireCrocFireCroc Member, PRO Posts: 60
    edited March 2023

    I think I found the problem. On the Game Salad publishing page looks like I did not enter this

    Can this be it?

  • ArmellineArmelline Member, PRO Posts: 5,316
    edited March 2023

    That would absolutely be it! I always forget that too, as I did here!

  • FireCrocFireCroc Member, PRO Posts: 60

    I feel like I am a step closer🙂 but something is still not right. I am still getting "pending" when I try to purchase

    Steps i have taken :

    1. I have updated the "Google Provided IAP License Key" and "Google Game Services App ID" fields in Game Salad publishing page
    2. Did a "Build RC"
    3. Downloaded AAB
    4. Signed and Uploaded the new AAB to play store

    When I try to do a purchase I get exactly the same results as before. The "purchased" event is just not triggered. On my debug field for "Purchase table" field 5 it just shows into pending

    I just want to check if I entered this correctly. Is the "Google Game Services App ID" the same as the "Android Package name"


  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,006

    The App ID looks wrong (but that shouldn't affect IAP), only Achievements and Leaderboards.

    If you look in the docs, we need to do a better job of calling it out, but it's the number under the game's name in the image after the line "Now press “Confirm”"

    https://help.gamesalad.com/gamesalad-cookbook/7-using-pro-features/7-google-play-games-services/

  • FireCrocFireCroc Member, PRO Posts: 60

    Thanks for this.

    Also what is strange is that after 2-3 days the IAP gets automatically refunded. I have reached out to Google Play Store to check the reasoning for the refunds, maybe they can give me a clue as to what is wrong

    Not sure what to check next?

  • FireCrocFireCroc Member, PRO Posts: 60

    This is what google is saying :

    "Regarding your issue, please note that failure to properly acknowledge purchases will result in purchases being refunded.

    In order for Google Play to ensure a consistent purchase experience regardless of where the user purchases your product, you must acknowledge all purchases received through the Google Play Billing Library as soon as possible after granting entitlement to the user. If you do not acknowledge a purchase within three days, the user automatically receives a refund, and Google Play revokes the purchase.

    For more detailed information, please refer to our Android Documentation."



    Do you think this is part of the issue I am having?

  • FireCrocFireCroc Member, PRO Posts: 60
    edited March 2023

    Looks like the problem is now sorted. Not sure if this is what fixed it. Every time I did an update from the playstore the problem was not fixed. What I did was Uninstaller the game from my phone and then reinstalled. Looks like this fixed it. Not sure if the original install stores some data that does not get overwritten when an update is done.

    The other thing I changed was that when a purchase was made I set a timer to check every 0.2 seconds for the word purchased instead of using 'after 0.2 seconds'

    Thanks for all your help trying to help Adent42 and Armelline. Appreciate it

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 251
    edited March 2023

    Ohhh that is key! When testing, don't auto-update. Delete the old version of the app completely before installing the new version.

    Glad you got it sorted @FireCroc

    GameSalad Templates and Custom Development at the Official Marketplace: http://gshelper.com

Sign In or Register to comment.