{"id":1037,"date":"2025-02-25T15:16:42","date_gmt":"2025-02-25T15:16:42","guid":{"rendered":"https:\/\/varnagame.site\/?p=1037"},"modified":"2026-02-25T09:05:51","modified_gmt":"2026-02-25T09:05:51","slug":"%d0%bf%d0%be%d0%bb%d1%83%d1%87%d0%b0%d0%b5%d0%bc-%d0%b4%d0%b0%d0%bd%d0%bd%d1%8b%d0%b5-%d0%b8%d0%b7-%d0%ba%d0%b2%d0%b8%d1%82%d0%b0%d0%bd%d1%86%d0%b8%d0%b8-google-%d0%b2-unity3d","status":"publish","type":"post","link":"https:\/\/varnagame.site\/?p=1037","title":{"rendered":"\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043a\u0432\u0438\u0442\u0430\u043d\u0446\u0438\u0438  Google\u00a0\u0432 Unity3D"},"content":{"rendered":"\n<p>PurchaseEventArgs \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c json \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c,  \u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Unity3D: MiniJSON \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0438 \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 JSON \u0438  \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 \u0441\u0442\u0440\u043e\u043a JSON.  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u043a\u0430\u0441\u043a\u0430\u0434\u043e\u043c. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 JSON \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443\u00a0<strong>Newtonsoft<\/strong>.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\"><code>public ReceiptData GetReceiptData(PurchaseEventArgs e)\n\n    {\n        ReceiptData data = new ReceiptData();\n\n        if (e != null)\n        {\n            \/\/Main receipt root\n            var wrapper = Json.Deserialize(e.purchasedProduct.receipt) as Dictionary&lt;string, object&gt;;\n\n            \/\/Next level Paylod dict\n            var payload = (string)wrapper[&quot;Payload&quot;]; \/\/ For Apple this will be the base64 encoded ASN.1 receipt\n            var payloadDict = Json.Deserialize(payload) as Dictionary&lt;string, object&gt;;\n\n            \/\/Stuff from json object\n            string jsonString = (string)payloadDict[&quot;json&quot;];  \n            var receiptStringDetails = Json.Deserialize(jsonString) as Dictionary&lt;string, object&gt;;\n\n            data.purchaseToken = (string)receiptStringDetails[&quot;purchaseToken&quot;];\n            data.orderId = (string)receiptStringDetails[&quot;orderId&quot;];\n            data.packageName = (string)receiptStringDetails[&quot;packageName&quot;];\n            data.productId = (string)receiptStringDetails[&quot;productId&quot;];\n\n            var purchaseTime = (long)receiptStringDetails[&quot;purchaseTime&quot;];\n            DateTime dateStartEra = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);\n            data.purchaseTime = dateStartEra.AddMilliseconds(purchaseTime);\n\n            \/\/Stuff from skuDetails object\n            string skuDetailsString = (string)payloadDict[&quot;skuDetails&quot;];\n            var skuDetailsDict = Json.Deserialize(skuDetailsString) as Dictionary&lt;string, object&gt;;\n\n            data.priceAmountMicros = Convert.ToInt64(skuDetailsDict[&quot;price_amount_micros&quot;]);\n            data.priceCurrencyCode = (string)skuDetailsDict[&quot;price_currency_code&quot;];\n\n            return data;\n        }\n        return data; \n    }<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\"><code>   public class ReceiptData\n    {\n        public string orderId;\n        public string packageName;\n        public string productId;\n        public DateTime purchaseTime;\n        public int purchaseState;\n        public string purchaseToken;\n        public long priceAmountMicros;\n        public string priceCurrencyCode;\n    }<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>PurchaseEventArgs \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c json \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Unity3D: MiniJSON \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0438&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,10,20],"tags":[],"_links":{"self":[{"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/posts\/1037"}],"collection":[{"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/varnagame.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1037"}],"version-history":[{"count":9,"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/posts\/1037\/revisions"}],"predecessor-version":[{"id":1052,"href":"https:\/\/varnagame.site\/index.php?rest_route=\/wp\/v2\/posts\/1037\/revisions\/1052"}],"wp:attachment":[{"href":"https:\/\/varnagame.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/varnagame.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/varnagame.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}