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] Get real receipt data from IAP payload

Discussion in 'Unity IAP' started by ailen, Feb 19, 2016.

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

    ailen

    Joined:
    Mar 4, 2014
    Posts:
    6
    From this quesiont http://forum.unity3d.com/threads/iap-receipt-is-not-base64-encoded.376756/

    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?

    I have the same question now!

    I'm using the https://github.com/nomad/venice to verify the order, the plugin need the Base64 encoded receipt data.

    how can i get the Base64 encoded data from payload?
     
  2. 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/
     
    alexeynes12 likes this.
  3. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Lee_won_hwan likes this.
  4. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi,
    I may be dumb, but I can't find a way to get the raw receipt as received from the Apple and Google store.
    Is the only way to parse the json receipt you create?
     
  5. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    00christian00 likes this.
  6. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Thanks! It would be handy to have the payload exposed just like the other field.
    For now I have resorted to parsing it.
     
    ap-unity likes this.
Thread Status:
Not open for further replies.