question

rootsnwonky avatar image
rootsnwonky asked

Item not owned in "GrantCharacterToUser"

Create a new Item in the Primary catalog, set "01" as ItemId, "Soldier" as DisplayName, pick "Is a token for character creation".

But still have "Item Not Owned" error in the next method:

public void BuyCharacter()
    {
        var request = new GrantCharacterToUserRequest();
        request.CatalogVersion = "Economy";
        request.CharacterName = "Soldier";
        request.ItemId = "01";


        PlayFabClientAPI.GrantCharacterToUser(request, OnBuyCharacter, OnPlayFabError);
    }
Character DataCharacters
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

·
Citrus Yan avatar image
Citrus Yan answered

In general, there are mainly two routes to grant a character to a player:

  1. Use the Server API call Server/GrantCharacterToUser to grant a character to a user, this requires no item defined in Catalog in advance.
  2. Use the Client API call Client/GrantCharacterToUser to grant a character to a user, this requires an item being a token for character creation defined in Catalog. Moreover, the user must also need to have this item added in his/her inventory before calling the Client/GrantCharacterToUser API to grant a character, this can be done by selling or granting the character item to the player. This mechanism intends to prevent cheats from the client-side.

It seems that you are implementing the second route, hence, you’ll need to have the player add the item into his/her inventory before calling Client/GrantCharacterToUser.

By the way, this thread contains a more detailed discussion on Character-related stuff you may find helpful, please navigate to the link to learn more.

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.

rootsnwonky avatar image rootsnwonky commented ·

Thanks, haven't checked yet, but think, this is the answer - l really didn't add an item to inventory.

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.