Platform Specific Methods - Validate IOS Receipt

Validates with the Apple store that the receipt for an iOS in-app purchase is valid and that it matches the purchased catalog item

POST https://titleId.playfabapi.com/Client/ValidateIOSReceipt

Request Body

Name Required Type Description
CatalogVersion
  • string

Catalog version of the fulfilled items. If null, defaults to the primary catalog.

CurrencyCode
  • string

Currency used to pay for the purchase (ISO 4217 currency code).

PurchasePrice True
  • number

Amount of the stated currency paid, in centesimal units.

ReceiptData True
  • string

Base64 encoded receipt data, passed back by the App Store as a result of a successful purchase.

Responses

Name Type Description
200 OK

Once verified, the catalog item matching the iTunes item name will be added to the user's inventory.

400 Bad Request

This is the outer-wrapper for all responses with errors

Security

SessionTicket

This API requires a client session ticket, available from any Client Login function.

Type: apiKey
In: header

Definitions

ApiErrorWrapper

The basic wrapper around every failed API response

ItemInstance

A unique instance of an item in a user's inventory. Note, to retrieve additional information for an item such as Tags, Description that are the same across all instances of the item, a call to GetCatalogItems is required. The ItemID of can be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set when the User's specific instance has updated the CustomData via a call to UpdateUserInventoryItemCustomData. Other fields such as UnitPrice and UnitCurrency are only set when the item was granted via a purchase.

PurchaseReceiptFulfillment
ValidateIOSReceiptRequest

The CurrencyCode and PurchasePrice must match the price which was set up for the item in the Apple store. In addition, The ItemId of the inventory in the PlayFab Catalog must match the Product ID as it was set up in the Apple store. This enables the PlayFab service to securely validate that the purchase is for the correct item, in order to prevent uses from passing valid receipts as being for more expensive items (passing a receipt for a 99-cent purchase as being for a $19.99 purchase, for example).

ValidateIOSReceiptResult

Once verified, the catalog item matching the iTunes item name will be added to the user's inventory.

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code
  • number

Numerical HTTP code

error
  • string

Playfab error code

errorCode
  • number

Numerical Playfab error code

errorDetails
  • object

Detailed description of individual issues with the request object

errorMessage
  • string

Description for the Playfab errorCode

status
  • string

String HTTP code

ItemInstance

A unique instance of an item in a user's inventory. Note, to retrieve additional information for an item such as Tags, Description that are the same across all instances of the item, a call to GetCatalogItems is required. The ItemID of can be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set when the User's specific instance has updated the CustomData via a call to UpdateUserInventoryItemCustomData. Other fields such as UnitPrice and UnitCurrency are only set when the item was granted via a purchase.

Name Type Description
Annotation
  • string

Game specific comment associated with this instance when it was added to the user inventory.

BundleContents
  • string[]

Array of unique items that were awarded when this catalog item was purchased.

BundleParent
  • string

Unique identifier for the parent inventory item, as defined in the catalog, for object which were added from a bundle or container.

CatalogVersion
  • string

Catalog version for the inventory item, when this instance was created.

CustomData
  • object

A set of custom key-value pairs on the instance of the inventory item, which is not to be confused with the catalog item's custom data.

DisplayName
  • string

CatalogItem.DisplayName at the time this item was purchased.

Expiration
  • string

Timestamp for when this instance will expire.

ItemClass
  • string

Class name for the inventory item, as defined in the catalog.

ItemId
  • string

Unique identifier for the inventory item, as defined in the catalog.

ItemInstanceId
  • string

Unique item identifier for this specific instance of the item.

PurchaseDate
  • string

Timestamp for when this instance was purchased.

RemainingUses
  • number

Total number of remaining uses, if this is a consumable item.

UnitCurrency
  • string

Currency type for the cost of the catalog item. Not available when granting items.

UnitPrice
  • number

Cost of the catalog item in the given currency. Not available when granting items.

UsesIncrementedBy
  • number

The number of uses that were added or removed to this item in this call.

PurchaseReceiptFulfillment

Name Type Description
FulfilledItems

Items granted to the player in fulfillment of the validated receipt.

RecordedPriceSource
  • string

Source of the payment price information for the recorded purchase transaction. A value of 'Request' indicates that the price specified in the request was used, whereas a value of 'Catalog' indicates that the real-money price of the catalog item matching the product ID in the validated receipt transaction and the currency specified in the request (defaulting to USD) was used.

RecordedTransactionCurrency
  • string

Currency used to purchase the items (ISO 4217 currency code).

RecordedTransactionTotal
  • number

Amount of the stated currency paid for the items, in centesimal units

ValidateIOSReceiptRequest

The CurrencyCode and PurchasePrice must match the price which was set up for the item in the Apple store. In addition, The ItemId of the inventory in the PlayFab Catalog must match the Product ID as it was set up in the Apple store. This enables the PlayFab service to securely validate that the purchase is for the correct item, in order to prevent uses from passing valid receipts as being for more expensive items (passing a receipt for a 99-cent purchase as being for a $19.99 purchase, for example).

Name Type Description
CatalogVersion
  • string

Catalog version of the fulfilled items. If null, defaults to the primary catalog.

CurrencyCode
  • string

Currency used to pay for the purchase (ISO 4217 currency code).

PurchasePrice
  • number

Amount of the stated currency paid, in centesimal units.

ReceiptData
  • string

Base64 encoded receipt data, passed back by the App Store as a result of a successful purchase.

ValidateIOSReceiptResult

Once verified, the catalog item matching the iTunes item name will be added to the user's inventory.

Name Type Description
Fulfillments

Fulfilled inventory items and recorded purchases in fulfillment of the validated receipt transactions.

Error Codes

Name Code
DownstreamServiceUnavailable 1127
InvalidBundleID 1098
InvalidCurrencyCode 1179
InvalidEnvironmentForReceipt 1300
InvalidProductForSubscription 1338
InvalidReceipt 1021
InvalidVirtualCurrency 1051
NoMatchingCatalogItemForReceipt 1178
ReceiptAlreadyUsed 1022
ReceiptContainsMultipleInAppItems 1097
ReceiptDoesNotContainInAppItems 1096
SubscriptionAlreadyTaken 1340