Hey devforum! I have one question: “How to get spent price of bought gamepass”
I used GetProductInfo after buying but it have one vuenability: user can change price of gamepass after buy and game will count it as new price.
Possible ways to fix:
check price BEFORE buying (price can be changed after checking (or not idk))
somehow get price from PromptGamePassPurchaseFinished but dont know how
are you doin this using a local script?? and who the user and how is he changin the prince??
Maybe put all the gamepass ids in a table and then loop through the table and get info about all the gamepass and then store the prices some where. Do this when the game starts
More context: doing some pls donate like game. Need to count raised/donated value. Looking for price, returns new, not really spended.
Doing with server side only ofc
Thats bad idea, overload http requests + price can be changed before updating info
Fetch the price as soon as you initiate the purchase prompt.
If the price changes while the prompt is on screen, the number on the button will not change.
When the player clicks buy, one of the parameters sent to the “purchase” endpoint is the expected price of the item (the number shown to them on the button). If the price has changed, it’ll hit them with an error. This is to prevent people from getting scammed.
This means if the price changes sometime between when the prompt was displayed and when the buy button is clicked, the purchase will not go through. Therefore, you can be fairly confident the price you fetched earlier was the actual amount they spent.