question

k-krrs avatar image
k-krrs asked

PlayFab.PurchaseItem purchases multiple instances of bought item

Hello!

I'm having an issue with purchasing items, where PlayFab.PurchaseItem actually purchases several instances of an item and spends the player's currency for no reason whatsoever. My code is simple and should work perfectly according to the logic. I really need some help, as I'm releasing my game in a week, and this is the only thing left to fix.

In-Game EconomyPlayer Inventory
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Testing in my own sample title, I can't reproduce what you describe. One call to PurchaseItem results in one purchase of the item, for the correct price from the catalog. Can you please provide us the following specifics, so that we can review the logs:

  • Title ID of the game
  • PlayFab ID of the user in the test
  • Item ID purchased
  • Time of the test
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

k-krrs avatar image k-krrs commented ·

TitleID is 1F03

PlayFab ID of the test user:

D60763CF4B01D060

ItemID: TrailColorOrange

Time: 4:41 PM

0 Likes 0 ·
brendan avatar image brendan ♦♦ k-krrs commented ·

Reviewing the logs, I'm seeing two distinct calls from the client to PurchaseItem at that time - one at 2017-11-03 15:41:09.358 UTC and the next at 2017-11-03 15:41:09.375 UTC. How specifically is the call being made in your code? Either the call is being sent twice in a row, or there's a retry that is firing immediately.

0 Likes 0 ·
k-krrs avatar image k-krrs brendan ♦♦ commented ·

I have a function called BuyItem that gets called if the item you're buying is not in your inventory. Attached are images of both the switch function for the buttons and the BuyItem function.

First picture is one of the cases of the button function, in this case, for the Dark Red color for Skis.

Second picture is the BuyItem function I've made. The button in one of the arguments was just my logic that the second purchaseitem was happening because the button stays pressed, so I made its onclick listener disappear, but it did not fix the problem.

0 Likes 0 ·
switch.png (28.2 KiB)
buyitem.png (10.4 KiB)
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.