Please opensource the IAP package code

Not just modification. I wish I could see what it internally doing and how each class was created, how each of string and json from native IAP system was parsed, and so on

Currently now I have stuck on the problem that, I want to parse and get IAP receipt data. But I don’t want to validate. I want to get data of the receipt to log and send to server first then validate later. If the source code was opened I could look at the source code of how the validator internally parse the receipt, which is far better

We have discussed this in the past, but we have no immediate plans to open source IAP.

I know I just voice my feedback again (that thread was already closed) so you know that we really should have that

Also do we have anyway to extract receipt information without validate it?

From the product receipt property. For example e.purchasedProduct.receipt as mentioned Unity - Manual: Receipt validation And we don’t want to give away our code at this point, sorry.

The problem is ios receipt payload is scrambled in weird format which is not documented in that document. And I want to extract information of that receipt out before validation which that document only mention about getting information after validating it

No, the receipt is passed as a parameter, it was just an example. You can use it without passing it to the Validator. Perhaps you are referring to Base64 encoding? How can i get the iOS base64 encoded receipt data from Unity IAP - Questions & Answers - Unity Discussions

Yes that’s right
But your link is not the solution I could use. Because it use valitor to validate the receipt to get the data. I want just the data but don’t want to validate it just yet

Correct, you just need product.receipt which may be Base64 encoded. You don’t need to pass it to our validator, you can do anything you want with the receipt instead.

It not only base64. I already decoded it with bas64 and seem like it use a weird binary format I’m not familiar with

Sorry I would not want to guess what you are seeing. Please show your code, and the results. If it is indeed binary, just post a snippet and I can confirm.

I am truly sorry but this is my weekend already. I have no access my workstation in my office until next week. So the same for that information

1 Like

You might already be familiar with Debug.Log for troubleshooting but I wanted to provide this also Tips for new Unity users

Yes, I have print the receipt with debug log so I see it was some base64 string, and decode it I found out it not actually string data. Instead it was some binary bits jumble with UTF8 string (I remember there is some datetime string and my game bundle ID in there)

But that’s from my office workstation at the middle of my work hour today. At this time is midnight of my timezone and my office was closed (my ios device is also office’s owned). I have write reply at before the end of the day so I can’t provide any more information to you just yet

No need to explain about your office hours, but thanks. Clearly, provide the data when you can.

Nevermind, I have figure out that there is a class responsible for this task. I could write it like this

var parsed = new UnityEngine.Purchasing.Security.AppleReceiptParser().Parse(System.Convert.FromBase64String(rawPayload));

It is indeed not a json string and being a custom format apple used (ASN.1 or something). But as I suspect, unity has internal class that could parse it. Fortunately this namespace was made public or else I could waste more time on this

This is also more of a reason IAP package should just be opensourced. So I could trace a source code to see that unity just use this class to parse the payload. There was no document mention this class. I just try to investigate all the class in this package myself

2 Likes