Documentation

GrantItemsToUser

Adds the specified items to the specified user's inventory

Request Details

This function directly adds inventory items to the user's inventories. As a result of this operations, the user will not be charged any transaction fee, regardless of the inventory item catalog definition. Please note that the processing time for inventory grants and purchases increases fractionally the more items are in the inventory, and the more items are in the grant/purchase operation.

GrantItemsToUserRequest
Request Properties
Annotation String

String detailing any additional information concerning this operation.

CatalogVersion String

Catalog version from which items are to be granted.

ItemIds (required) List<String>

Array of itemIds to grant to the user.

PlayFabId (required) String

Unique PlayFab assigned ID of the user on whom the operation will be performed.

POST https://{{TitleID}}.playfabapi.com/Server/GrantItemsToUser
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "PlayFabId": "20394883",
  "Annotation": "Entered Level 2",
  "ItemIds": [
    "shield_level_3",
    "shield_level_4"
  ]
}
        

Response Details

Please note that the order of the items in the response may not match the order of items in the request.

GrantItemsToUserResult
Result Properties
ItemGrantResults List<GrantedItemInstance>

Array of items granted to users.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "ItemGrantResults": [
      {
        "PlayFabId": "20394883",
        "Result": true,
        "ItemId": "shield_level_3",
        "ItemInstanceId": "133713371337",
        "ItemClass": "shields",
        "PurchaseDate": "2017-03-07T00:00:00Z",
        "Expiration": "2018-10-01T00:00:00Z",
        "RemainingUses": 10,
        "Annotation": "Entered Level 2",
        "CatalogVersion": "5",
        "BundleParent": "crate block 1",
        "UnitPrice": 0
      },
      {
        "PlayFabId": "20394883",
        "Result": true,
        "ItemId": "shield_level_4",
        "ItemInstanceId": "133713371337",
        "ItemClass": "shields",
        "PurchaseDate": "2017-03-07T00:00:00Z",
        "Expiration": "2018-10-01T00:00:00Z",
        "RemainingUses": 10,
        "Annotation": "Entered Level 2",
        "CatalogVersion": "5",
        "BundleParent": "crate block 1",
        "UnitPrice": 0
      }
    ]
  }
}

Authentication

SecretKey

Possible Error Codes

Name Code
CatalogNotConfigured 1218