Search Unity

Gameroom IAP (webgl) receipt data malformed

Discussion in 'Unity IAP' started by TheSofaKing, Feb 26, 2018.

  1. TheSofaKing

    TheSofaKing

    Joined:
    Jun 10, 2015
    Posts:
    13
    Receipt data malformed when first purchase is not validated and confirmed, that is when purchase from Facebook succeeds but is not cleared. After refreshing page and IAP is reinitialized, it gets data and IAP FB logs:

    UnityIAP FB: RetrievePurchases()
    UnityIAP FB: end of paged purchases, sending ..... {"purchaseToken":"101553574.......","paymentId":"148047311.......","purchaseTime":1519634452,"appId":"1022530...........","signedRequest":"aHhfPd9R-kdu7UhmOHMo1jsAm3aEh7OdxpW6Je9Pwf4.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImFwcF9pZCI6MTAyMjUzMDE2OTM3NzMyLCJpc3N1ZWRfYXQiOjE1MTk2Njk1MzIsInBheW1lbnRfYWN0aW9uX3R5cGUiOiJjaGFyZ2UiLCJwYXltZW50X2lkIjoxNDgwNDczMTE4NzMwNDMwLCJwcm9kdWN0X2lkIjoiY29tLnRyb3BoeW1hbmFnZXIucHJvMTFfcGtnMSIsInB1cmNoYXNlX3RpbWUiOjE1MTk2MzQ0NTIsInB1cmNoYXNlX3Rva2VuIjoxMDE1NTM1NzQ2MzI5MzYwwww"}


    so the purchase data is correct here and correct data was sent for validation initially right after purchase, but after page refresh when it calls "PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)" then the receipt Payload in the args is wrong:

    {"Store":"FacebookStore","TransactionID":"101553574............","Payload":"System.Collections.Generic.Dictionary`2[System.String,System.Object]"}

    Has anyone else come across a similar issue?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @TheSofaKing Can you elaborate as to what you are referring to as "page refresh"? Do you mean restarting your game? Please describe how this impacts your purchase flow and how we would reproduce the issue here.
     
  3. TheSofaKing

    TheSofaKing

    Joined:
    Jun 10, 2015
    Posts:
    13
    The issue is with webgl gameroom build running in canvas and purchase flow interrupted. So the Facebook purchase went through but was not fulfilled in the app, m_StoreController.ConfirmPendingPurchase(purchasedProduct) was not called as window was closed before.

    . Next time loading the webgl app the API gets the pending purchase, in the UnityIAP logs the purchase data looks good, but but when UnityIAP calls ProcessPurchase after startup to clear the purchase the Payload is not a readable string but instead says System.Collections.Generic.Dictionary`2[System.String,System.Object]"
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide specific steps to reproduce on a new project. How and when is the purchase flow interrupted, for example?
     
  5. TheSofaKing

    TheSofaKing

    Joined:
    Jun 10, 2015
    Posts:
    13
    1. buy item in webgl gameroom build in facebook canvas
    2. don't confirm purchase, leave it pending
    3. close fbapp, open back up and start
    4. see if data is messed up when it tries to autocomplete pending purchase
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @TheSofaKing Great, thank you for the steps to reproduce. We are investigating here. Once we can reproduce, we'll prioritize and schedule the potential fix for inclusion in a future version.
     
  7. TheSofaKing

    TheSofaKing

    Joined:
    Jun 10, 2015
    Posts:
    13
    ...so its Unity IAP 1.19.0 but this is still an issue. The "Payload" inside the event arge (public Purchasing.PurchaseProcessingResult ProcessPurchase(Purchasing.PurchaseEventArgs e);) is just a string that sais "System.Collections.Generic.Dictionary`2[System.String,System.Object]"

    {"Store":"FacebookStore","TransactionID":"1015535746000","Payload":"System.Collections.Generic.Dictionary`2[System.String,System.Object]"}
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Are you able to provide the full logs, from IAP initialization up to the issue?
     
  9. Brandon-BBstudio

    Brandon-BBstudio

    Joined:
    Nov 13, 2017
    Posts:
    8
    I also have the same problem with the same reproduction path.
    It seems to call toString without make json string for "json" object received from calling "app/purchase" method in facebook sdk.
    Please chek this link.
    It is reproduced 100%.
     
  10. SevenPointRed

    SevenPointRed

    Joined:
    Feb 3, 2016
    Posts:
    218
    Sorry to dig this up but I'm also getting this on Gameroom Windows.
     
  11. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @SevenPointRed Can you confirm that returning Pending from ProcessPurchase is sufficient to trigger the error on the next app launch? Can you try a test with a special build that returns Pending? Upon next app start, you should see a ProcessPurchase method call. Other members here are claiming that the ProcessPurchase argument is a string and not an object, and leads to the error.
     
  12. SevenPointRed

    SevenPointRed

    Joined:
    Feb 3, 2016
    Posts:
    218
    I was able to replicate this issue by always returning pending, it gave a valid receipt then an invalid receipt on relaunch.
     
  13. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We will investigate, and hopefully address this issue in the next release.