Search Unity

[Solved] Exception when restoring purchase (iOS)

Discussion in 'Unity IAP' started by Nicolas1212, Jun 23, 2016.

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

    Nicolas1212

    Joined:
    Dec 18, 2014
    Posts:
    139
    Hi,

    We've recently hit an exception when restoring a purchase on iOS. The device asks for the user's password, and whether they enter it or hit cancel, we get the following exception:

    ArgumentException: Failed to load data.
    at LipingShare.LCLib.Asn1Processor.Asn1Parser.LoadData (System.IO.Stream stream) [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.Security.AppleValidator.Validate (System.Byte[] receiptData) [0x00000] in <filename unknown>:0
    at UnityEngine.Purchasing.Security.CrossPlatformValidator.Validate (System.String unityIAPReceipt) [0x00000] in <filename unknown>:0
    at UnityPurchaseManager._validateProductLocally (UnityEngine.Purchasing.Product product, System.String& errorMsg) [0x00000] in <filename unknown>:0
    at UnityPurchaseManager._handleWaitingPurchases () [0x00000] in <filename unknown>:0

    UnityPurchaseManager is our class for dealing with all things purchase.

    Anyone have any ideas how this came around?

    Steps:
    • Building with latest Unity (5.3.5p4)
    • Run on device through Xcode, so we have logs
    • Make purchase
    • Store is in different country than test user (Store was Canadian, user account was French)
    • Storekit continuously asks for password and if you want to change accounts throughout purchase flow (possibly at every step)
    • App is closed
    • On relaunch, we see there's a pending purchase
    • App asks for password
    • On enter/cancel, exception is thrown
     
  2. Nicolas1212

    Nicolas1212

    Joined:
    Dec 18, 2014
    Posts:
    139
    Is there meant to be something in the payload?

    Current receipt is like this:

    {"Store":"AppleAppStore","TransactionID":"1000000219344785","Payload":""}
     
  3. Nicolas1212

    Nicolas1212

    Joined:
    Dec 18, 2014
    Posts:
    139
    Okay, so the receipt should have something in it like so:

    receipt: {"Store":"AppleAppStore","TransactionID":"1000000219404517","Payload":"MIIT3wYJKoZIhvcNAQcCoIIT0DCCE8wCAQExCzAJBgUrDgMCGgUAMIIDgAYJKoZIhvcNAQcBoIIDcQSCA20xggNpMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwA...

    So it seems like it's possible when restoring purchases to not have something here in rare cases
     
  4. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    Hi @Nicolas1212,

    Are you still having this issue? It sounds more like a bug on Apple's side...Can you submit a TSI to Apple with the issue and the transaction ID of the receipts with empty payloads and let us know what they say?
     
  5. Nicolas1212

    Nicolas1212

    Joined:
    Dec 18, 2014
    Posts:
    139
    Okay, I'll try and build out a test project and submit - we just passed a review, so it's a bit hectic at the minute
     
    erika_d likes this.
Thread Status:
Not open for further replies.