Search Unity

[Solved] Restoring and saving iOS receipts locally

Discussion in 'Unity IAP' started by stevencoull, Dec 14, 2016.

Thread Status:
Not open for further replies.
  1. stevencoull

    stevencoull

    Joined:
    Sep 15, 2016
    Posts:
    16
    I am working on a game where users can buy an auto-renewing one month subscription to our service. The receipt has to be sent to our server for verification when the application opens, and every 30 minutes after that. Android is up and running, but I've had some trouble with iOS.

    In my original implementation for iOS, RestoreTransaction() was called when the app loads allowing me to send the receipt to the server. However from my understanding, RestoreTransaction() is used to get the latest receipt from Apple, and should be used when a user wants to download content to a new device or after a reinstall, not something that should be called every time the application opens. But if I don't call it on load, there is no receipt in:
    storeController.products.WithID(ProductID).receipt;​
    Should I be storing the user's receipt locally after RestoreTransaction() or ProcessPurchase(), or is there another way to get the receipt?
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @stevencoull,

    Restoring Purchases on iOS requires the user to enter their Apple ID, which can be annoying to do every time the user opens your app. This is why Apple discourages restoring purchases every time the app is opened.

    https://developer.apple.com/library...ceptual/StoreKitGuide/Chapters/Restoring.html

    So you can save the receipt locally in ProcessPurchase() or parse the Apple receipt to see what products are owned.
     
Thread Status:
Not open for further replies.