question

Saphal Aryal avatar image
Saphal Aryal asked

On purchasing inventory of 500 , Virtual Currency of 1000 is subtracted

I have checked wheather I have called purchase function twice or virtual currency function twice . I found that these function are called only once but virtual currency is subtracted 1000 instead of 500 .

What can be the cause of this strange problem ?

How can I fix This ?

Player Inventorycommunity
1 comment
10 |1200

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

Xiao Zha avatar image Xiao Zha commented ·

We test the purchase API and it works fine, so I can’t reproduce your issue. Can you provide the relevant code snippets or screenshots for further research.

0 Likes 0 ·

1 Answer

·
Saphal Aryal avatar image
Saphal Aryal answered

@Xiao Zha

  • Does This Code automatically decreases the virtual currency ?
public void MakeItemPurchase(int index)
    {
        BoardSkin board = boardDB.GetBoard(index);
        ShopItemUI uiItem = boardShopUI.GetItemUI(index);


        var request = new PurchaseItemRequest
        {
            CatalogVersion = "Board",
            Price = board.price,
            VirtualCurrency = "GD",
            ItemId=board.name
        };
        PlayFabClientAPI.PurchaseItem(request,
            result => 
            {
                boardShopUI.ItemPurchased(index);            
            },
            error => 
            {
                Debug.Log("Purchase Item Error");


            });
    }
  • I have separate code to decrease virtual currency.that might be reason of decreasing of virtual currency :(
3 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.

Saphal Aryal avatar image Saphal Aryal commented ·

I tried a lot to fix it : (

Would you explain what might be the probable cause for this issue ?

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha commented ·

Your code seems correct, the API does automatically reduce the virtual currency so you don't need to do it manually.

0 Likes 0 ·
Saphal Aryal avatar image Saphal Aryal commented ·

Thanks a Lot ! Finally Problem is Solved :)

0 Likes 0 ·

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.