• Sign Up Login
  • Features
    • Game Services
    • Real-time Analytics
    • LiveOps
    • Add-ons
  • Game Services
  • Real-time Analytics
  • LiveOps
  • Add-ons
  • Games
  • Pricing
  • Blog
  • Support
    • Docs
    • Forums
    • Contact
  • Docs
  • Forums
  • Contact
  • Sign Up Login
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Ideas
    • Articles
    • Users
    • Badges
  • Home /
  • Bugs /
avatar image
Question by k-krrs · Nov 03, 2017 at 02:12 AM · In-Game EconomyPlayer Inventory

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.

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Nov 03, 2017 at 02:16 AM

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
Comment

People who like this

0 Show 4 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image k-krrs · Nov 03, 2017 at 04:06 PM 0
Share

TitleID is 1F03

PlayFab ID of the test user:

D60763CF4B01D060

ItemID: TrailColorOrange

Time: 4:41 PM

avatar image Brendan ♦♦ k-krrs · Nov 04, 2017 at 12:43 AM 0
Share

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.

avatar image k-krrs Brendan ♦♦ · Nov 04, 2017 at 12:23 PM 0
Share

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.

switch.png (28.9 kB)
buyitem.png (10.7 kB)
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Catalog Versions in inventory 1 Answer

    GetCatalogItems returns empty properties (discarded in the past) 1 Answer

    Empty Custom data for item instances 1 Answer

    Item provides not happening even after using Playfab payment API 0 Answers

    ValidateWindowsStoreReceipt error 400 Invalid receipt 1 Answer

    • PlayFab

      • Features
      • Games
      • Pricing
      • Blog
    • Engineers

      • Documentation
      • Quickstarts
      • API Reference
      • SDKs
      • Usage Limits
    • Support

      • Forums
      • Videos
      • Contact
      • Service Health
      • Terms of Service
    • Social

      • Facebook
      • Twitter
      • LinkedIn
      • YouTube
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • About Microsoft
    • Jobs
    • Accessibility
    • Diversity & inclusion
    • Security
    • Company news
    • © Microsoft 2019
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Post an idea
    • Create an article
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Ideas
    • Articles
    • Users
    • Badges