> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Restore IOS Purchases

> _NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new Economy features are being developed only for version 2._ Restores all in-app purchases based on the given restore receipt

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| InvalidBundleID | 1098 |
| InvalidCurrencyCode | 1179 |
| InvalidEnvironmentForReceipt | 1300 |
| InvalidReceipt | 1021 |
| InvalidVirtualCurrency | 1051 |
| NoMatchingCatalogItemForReceipt | 1178 |
| ProductDisabledForTitle | 1609 |
| ReceiptAlreadyUsed | 1022 |
| ReceiptContainsMultipleInAppItems | 1097 |
| ReceiptDoesNotContainInAppItems | 1096 |




## OpenAPI

````yaml /services/playfab/api-references/rest/client/client.openapi.json post /Client/RestoreIOSPurchases
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab Client API
  description: >-
    APIs which provide the full range of PlayFab features available to the
    client - authentication, account and data management, inventory, friends,
    matchmaking, reporting, and platform-specific functionality
  termsOfService: https://playfab.com/terms/
  contact:
    url: https://community.playfab.com/index.html
  license:
    name: Apache 2.0
    url: https://github.com/PlayFab/API_Specs/blob/master/LICENSE
servers:
  - url: https://{titleId}.playfabapi.com
    description: PlayFab title endpoint
    variables:
      titleId:
        default: your_title_id
        description: Your PlayFab title ID (hex).
security: []
tags:
  - name: Account Management
    description: Account Management APIs
  - name: Advertising
    description: Advertising APIs
  - name: Analytics
    description: Analytics APIs
  - name: Authentication
    description: Authentication APIs
  - name: Character Data
    description: Character Data APIs
  - name: Characters
    description: Characters APIs
  - name: Content
    description: Content Service APIs
  - name: Friend List Management
    description: Friend List Management APIs
  - name: Matchmaking
    description: Matchmaking APIs
  - name: Platform Specific Methods
    description: Platform Specific Methods APIs
  - name: Player Data Management
    description: Player Data Management APIs
  - name: Player Item Management
    description: Player Item Management APIs
  - name: PlayStream
    description: PlayStream Management APIs
  - name: Server-Side Cloud Script
    description: Server-Side Cloud Script APIs
  - name: Shared Group Data
    description: Shared Group Data APIs
  - name: Title-Wide Data Management
    description: Title-Wide Data Management APIs
  - name: Trading
    description: Trading Management APIs
paths:
  /Client/RestoreIOSPurchases:
    post:
      tags:
        - Platform Specific Methods
      summary: Restore IOS Purchases
      description: >
        _NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new
        Economy features are being developed only for version 2._ Restores all
        in-app purchases based on the given restore receipt


        ## Error codes


        This operation may return the following PlayFab errors:


        | Error | Code |

        | --- | --- |

        | InvalidBundleID | 1098 |

        | InvalidCurrencyCode | 1179 |

        | InvalidEnvironmentForReceipt | 1300 |

        | InvalidReceipt | 1021 |

        | InvalidVirtualCurrency | 1051 |

        | NoMatchingCatalogItemForReceipt | 1178 |

        | ProductDisabledForTitle | 1609 |

        | ReceiptAlreadyUsed | 1022 |

        | ReceiptContainsMultipleInAppItems | 1097 |

        | ReceiptDoesNotContainInAppItems | 1096 |
      operationId: RestoreIOSPurchases
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestoreIOSPurchasesRequest'
        description: >-
          The title should obtain a refresh receipt via
          restoreCompletedTransactions in the SKPaymentQueue of the Apple
          StoreKit and pass that in to this call. The resultant receipt contains
          new receipt instances for all non-consumable goods previously
          purchased by the user. This API call iterates through every purchase
          in the receipt and restores the items if they still exist in the
          catalog and can be validated.
      responses:
        '200':
          $ref: '#/components/responses/RestoreIOSPurchasesResult'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - SessionTicket: []
components:
  schemas:
    RestoreIOSPurchasesRequest:
      description: >-
        The title should obtain a refresh receipt via
        restoreCompletedTransactions in the SKPaymentQueue of the Apple StoreKit
        and pass that in to this call. The resultant receipt contains new
        receipt instances for all non-consumable goods previously purchased by
        the user. This API call iterates through every purchase in the receipt
        and restores the items if they still exist in the catalog and can be
        validated.
      type: object
      properties:
        CatalogVersion:
          description: >-
            Catalog version of the restored items. If null, defaults to primary
            catalog.
          type: string
        CustomTags:
          description: >-
            The optional custom tags associated with the request (e.g. build
            number, external trace identifiers, etc.).
          type: object
        ReceiptData:
          description: >-
            Base64 encoded receipt data, passed back by the App Store as a
            result of a successful purchase.
          type: string
      required:
        - ReceiptData
      example:
        ReceiptData: F00000000000000000000
    RestoreIOSPurchasesResult:
      description: >-
        Once verified, the valid items will be restored into the user's
        inventory. This result should be used for immediate updates to the local
        client game state as opposed to the GetUserInventory API which can have
        an up to half second delay.
      type: object
      properties:
        Fulfillments:
          description: >-
            Fulfilled inventory items and recorded purchases in fulfillment of
            the validated receipt transactions.
          type: array
          items:
            $ref: '#/components/schemas/PurchaseReceiptFulfillment'
          x-isclass: true
      example:
        Fulfillments:
          - FulfilledItems:
              - ItemId: shield_level_5
                ItemInstanceId: A1437F80BE99D3E8
                ItemClass: shields
                PurchaseDate: '2019-03-07T00:00:00'
                Expiration: '2020-10-01T00:00:00'
                RemainingUses: 10
                CatalogVersion: '5'
    ApiErrorWrapper:
      description: The basic wrapper around every failed API response
      type: object
      properties:
        code:
          description: Numerical HTTP code
          type: integer
        status:
          description: String HTTP code
          type: string
        error:
          description: Playfab error code
          type: string
        errorCode:
          description: Numerical PlayFab error code
          type: integer
        errorMessage:
          description: Description for the PlayFab errorCode
          type: string
        errorDetails:
          description: Detailed description of individual issues with the request object
          type: object
      required:
        - code
        - errorCode
    PurchaseReceiptFulfillment:
      type: object
      properties:
        FulfilledItems:
          description: Items granted to the player in fulfillment of the validated receipt.
          type: array
          items:
            $ref: '#/components/schemas/ItemInstance'
          x-isclass: true
        RecordedPriceSource:
          description: >-
            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.
          type: string
        RecordedTransactionCurrency:
          description: Currency used to purchase the items (ISO 4217 currency code).
          type: string
        RecordedTransactionTotal:
          description: >-
            Amount of the stated currency paid for the items, in centesimal
            units
          type: number
          x-actualtype: uint32
    ItemInstance:
      description: >-
        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.
      type: object
      properties:
        Annotation:
          description: >-
            Game specific comment associated with this instance when it was
            added to the user inventory.
          type: string
        BundleContents:
          description: >-
            Array of unique items that were awarded when this catalog item was
            purchased.
          type: array
          items:
            type: string
        BundleParent:
          description: >-
            Unique identifier for the parent inventory item, as defined in the
            catalog, for object which were added from a bundle or container.
          type: string
        CatalogVersion:
          description: >-
            Catalog version for the inventory item, when this instance was
            created.
          type: string
        CustomData:
          description: >-
            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.
          type: object
        DisplayName:
          description: CatalogItem.DisplayName at the time this item was purchased.
          type: string
        Expiration:
          description: Timestamp for when this instance will expire.
          type: string
        ItemClass:
          description: Class name for the inventory item, as defined in the catalog.
          type: string
        ItemId:
          description: Unique identifier for the inventory item, as defined in the catalog.
          type: string
        ItemInstanceId:
          description: Unique item identifier for this specific instance of the item.
          type: string
        PurchaseDate:
          description: Timestamp for when this instance was purchased.
          type: string
        RemainingUses:
          description: Total number of remaining uses, if this is a consumable item.
          type: number
          x-actualtype: int32
        UnitCurrency:
          description: >-
            Currency type for the cost of the catalog item. Not available when
            granting items.
          type: string
        UnitPrice:
          description: >-
            Cost of the catalog item in the given currency. Not available when
            granting items.
          type: number
          x-actualtype: uint32
        UsesIncrementedBy:
          description: >-
            The number of uses that were added or removed to this item in this
            call.
          type: number
          x-actualtype: int32
      required:
        - UnitPrice
      example:
        ItemId: shield_level_5
        ItemInstanceId: '133713371337'
        ItemClass: shields
        PurchaseDate: '2017-03-07T00:00:00'
        Expiration: '2018-10-01T00:00:00'
        RemainingUses: 10
        Annotation: No Annotation
        CatalogVersion: '5'
        BundleParent: crate block 1
      x-sortKey: ItemInstanceId
  responses:
    RestoreIOSPurchasesResult:
      description: >-
        Once verified, the valid items will be restored into the user's
        inventory. This result should be used for immediate updates to the local
        client game state as opposed to the GetUserInventory API which can have
        an up to half second delay.
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                description: >-
                  The Http status code. If X-ReportErrorAsSuccess header is set
                  to true, this will report the actual http error code.
              status:
                type: string
                description: The Http status code as a string.
              data:
                $ref: '#/components/schemas/RestoreIOSPurchasesResult'
            example:
              code: 200
              status: OK
              data:
                Fulfillments:
                  - FulfilledItems:
                      - ItemId: shield_level_5
                        ItemInstanceId: A1437F80BE99D3E8
                        ItemClass: shields
                        PurchaseDate: '2019-03-07T00:00:00'
                        Expiration: '2020-10-01T00:00:00'
                        RemainingUses: 10
                        CatalogVersion: '5'
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    SessionTicket:
      type: apiKey
      in: header
      name: X-Authorization
      description: >-
        This API requires a client session ticket, available from any Client
        Login function.

````

## Related topics

- [Restore IOS Purchases](/services/playfab/api-references/rest/client/platform-specific-methods/restore-ios-purchases.md)
- [PlayFab Release Notes 2019](/services/playfab/release-notes/2019.md)
- [Validate IOS Receipt](/services/playfab/api-references/rest/client/platform-specific-methods/validate-ios-receipt.md)
- [Integrating the Universal Windows Platform with PlayFab](/services/playfab/identity/player-identity/platform-specific-authentication/uwp-integration.md)
- [Redeem Apple App Store In-App Purchases](/services/playfab/economy-monetization/economy-v2/marketplace/marketplace-redemption/apple.md)
