Search Unity

[Closed] Unity IAP Facebook WebGl - Payload Issues on Pending Purchases

Discussion in 'Unity IAP' started by Robert_231Play, Oct 12, 2017.

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

    Robert_231Play

    Joined:
    Jun 13, 2016
    Posts:
    6
    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:
    Code (JavaScript):
    1. const receipt = {
    2.     "productID": "storeGoldPack200-4.0.1",
    3.     "transactionID": "1301665869944306",
    4.     "payload": "{\"json\":{\"purchaseToken\":\"1301665869944306\",\"paymentId\":\"1122371451226681\",\"purchaseTime\":1507732476,\"appId\":\"1458572774214371\",\"signedRequest\":\"kXt_VvZqfBf2nAdNqvKyvQ7SYPUG-jJ-8vorGsg2U84.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImFtb3VudCI6IjIuMDkiLCJhcHBfaWQiOiIxNDU4NTcyNzc0MjE0MzcxIiwiY3VycmVuY3kiOiJFVVIiLCJpc3N1ZWRfYXQiOjE1MDc3MzI0NzgsInBheW1lbnRfaWQiOiIxMTIyMzcxNDUxMjI2NjgxIiwicHJvZHVjdF9pZCI6ImNvbS50d28zMS5tYWhqb25nY2l0eS5nb2xkcGFja18yMDAiLCJwdXJjaGFzZV90aW1lIjoxNTA3NzMyNDc2LCJwdXJjaGFzZV90b2tlbiI6IjEzMDE2NjU4Njk5NDQzMDYiLCJxdWFudGl0eSI6IjEiLCJzdGF0dXMiOiJjb21wbGV0ZWQifQ\"}}"
    5. };
    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:
    Code (JavaScript):
    1. const receipt = {
    2.         "productID": "storeGoldPack200-4.0.1",
    3.         "transactionID": "1301665869944306",
    4.         "payload": "System.Collections.Generic.Dictionary`2[System.String,System.Object]"
    5. };
    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:
    Code (JavaScript):
    1. blob:https://apps-1458572774214371.apps.fbsbx.com/faa7fbd0-00fa-4579-9541-31dd33a7e85c:18744 Uncaught TypeError: Module.asm is not a function
    2.     at Object.UnityLoader.23e47c3ec6d8ffe482cea20b3a8268c4 (blob:https://apps-1458572774214371.apps.fbsbx.com/faa7fbd0-00fa-4579-9541-31dd33a7e85c:18744)
    3.     at UnityLoader.loadCode.Module (UnityLoader.js:95)
    4.     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?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. Robert_231Play

    Robert_231Play

    Joined:
    Jun 13, 2016
    Posts:
    6
    Hey Jeff,
    regarding the Module load code somehow, but the main issue is more related to the malformed payload.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Does this occur on all target platforms for you? Also, 1.14.1 was just released, can you test with this new version?
     
  5. Robert_231Play

    Robert_231Play

    Joined:
    Jun 13, 2016
    Posts:
    6
    It only occurs on WebGL Facebook. I will test the new version later.
     
Thread Status:
Not open for further replies.