Hey guys,
first a few information:
so we are using unity IAP on Android (Google Play & Amazon), iOS and now also on facebook (WebGL).
We are using Unity 5.6.3p1, IAP 1.13.1 and FB SDK (7.9.4 from facebook sdk page, not the unity-built in, cause it is not working on non-facebook platforms).
what is the issue?
In general unity iap is working great, even on WebGl. The user does a purchase, and the receipt of this product looks like this:
const receipt = {
"productID": "storeGoldPack200-4.0.1",
"transactionID": "1301665869944306",
"payload": "{\"json\":{\"purchaseToken\":\"1301665869944306\",\"paymentId\":\"1122371451226681\",\"purchaseTime\":1507732476,\"appId\":\"1458572774214371\",\"signedRequest\":\"kXt_VvZqfBf2nAdNqvKyvQ7SYPUG-jJ-8vorGsg2U84.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImFtb3VudCI6IjIuMDkiLCJhcHBfaWQiOiIxNDU4NTcyNzc0MjE0MzcxIiwiY3VycmVuY3kiOiJFVVIiLCJpc3N1ZWRfYXQiOjE1MDc3MzI0NzgsInBheW1lbnRfaWQiOiIxMTIyMzcxNDUxMjI2NjgxIiwicHJvZHVjdF9pZCI6ImNvbS50d28zMS5tYWhqb25nY2l0eS5nb2xkcGFja18yMDAiLCJwdXJjaGFzZV90aW1lIjoxNTA3NzMyNDc2LCJwdXJjaGFzZV90b2tlbiI6IjEzMDE2NjU4Njk5NDQzMDYiLCJxdWFudGl0eSI6IjEiLCJzdGF0dXMiOiJjb21wbGV0ZWQifQ\"}}"
};
But if we now, for whatever reason, do not complete the purchase, the purchase will be handled again after the application gets started again and purchasing has been initialized.
But this time the receipt looks different, with a malformed payload:
const receipt = {
"productID": "storeGoldPack200-4.0.1",
"transactionID": "1301665869944306",
"payload": "System.Collections.Generic.Dictionary`2[System.String,System.Object]"
};
It is easily to see that some json thing inside unity’s purchasing went wrong, cause it seems like the original payload, which was a Dictionary<string, object> was simple called .ToString().
Now we thought, well maybe our unity IAP is too old, cause their is IAP 1.14.0 out. But after we update the unity IAP to 1.14.0 the webgl application is not even working anymore.
The webgl application is throwing the following exception with the new IAP:
blob:https://apps-1458572774214371.apps.fbsbx.com/faa7fbd0-00fa-4579-9541-31dd33a7e85c:18744 Uncaught TypeError: Module.asm is not a function
at Object.UnityLoader.23e47c3ec6d8ffe482cea20b3a8268c4 (blob:https://apps-1458572774214371.apps.fbsbx.com/faa7fbd0-00fa-4579-9541-31dd33a7e85c:18744)
at UnityLoader.loadCode.Module (UnityLoader.js:95)
at HTMLScriptElement.script.onload (UnityLoader.js:26)
Now here is the question:
a) can the issue be fixed without unity iap update or is not even related to it?
b) why the applcation crashes after the update?