Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Solved] IAP receipt is not base64 encoded.

Discussion in 'Unity IAP' started by bluesky139, Dec 30, 2015.

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

    bluesky139

    Joined:
    Aug 24, 2012
    Posts:
    8
    I'm using Unity 5.3 built-in IAP service, and testing it on iOS. When purchasing success, I can get receipt from UnityEngine.Purchasing.Product.receipt .

    It looks like this: {"Store":"AppleAppStore","TransactionID":"1000000186798000","Payload":"MIIT4AYJKoZIhvcNAQcCoIIT0TCC..."}

    From doc: http://docs.unity3d.com/Manual/UnityIAPPurchaseReceipts.html "Payload" should be base64 encoded on iOS > 7.0, but it's not, I tried to decode it, it's ASN.1 encoded.

    Why it's not base64 encoded, where am I wrong?
     
  2. mpinol

    mpinol

    Joined:
    Jul 29, 2015
    Posts:
    317
    Hi @bluesky139,

    It is both base64 and ASN.1 encoded. That is, after it has been ASN.1 encoded it is then base64 encoded. Essentially the encoding scheme looks something like, base64 ( asn.1 ( collection of receipt details ) ) Let me know if you need me to elaborate on this a bit more, it can get a little confusing the further we go.

    Can you please open a support ticket here, https://analytics.cloud.unity3d.com/support and include your entire receipt so that I can take a look? Creating the ticket will help me keep track of your issue as well as give me a little more information about your project.
     
  3. bluesky139

    bluesky139

    Joined:
    Aug 24, 2012
    Posts:
    8
    Hi @mpinol,
    I just opened a ticket with same title, please check and give me more support, thank you very much.
     
  4. ailen

    ailen

    Joined:
    Mar 4, 2014
    Posts:
    6
    Hi @mpinol,
    I'm using the unity iap, I want to verify iOS iap from my server, the iOS payment only return the payload, how can i get the receipt info form the payload?
     
  5. mpinol

    mpinol

    Joined:
    Jul 29, 2015
    Posts:
    317
    Hi @ailen,

    This "Payload" is base64 encoded ASN.1, decoding it from base64 returns what looks like a bunch of jumbled characters but is actually the ASN.1.

    For verifying the receipt from Apple you would send the "Payload" value to the appropriate verifying URL which you can find here under 'Send Receipt Data to App Store', https://developer.apple.com/library...ppStoreReceipt/Chapters/ValidateRemotely.html

    Also, Unity Analytics offers receipt verification which you can read more about here, http://forum.unity3d.com/threads/tracking-monetization-receipt-verification.314056/

    I hope this helps!
     
Thread Status:
Not open for further replies.