Search Unity

Newer Unity IAP has different TransactionID for Google Play

Discussion in 'Unity IAP' started by JustAnotherDude, Dec 14, 2020.

  1. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    On version 1.23.1 and In App purchasing package version 2.0.6 when I make a purchase and receive the product, the transactionID from Google comes in the format like GPA.XXXX.

    On the latest version this was changed to a much longer string of characters... Is this intentional?

    Isn't GPA.XXX the desired format here?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    JustAnotherDude likes this.
  3. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    What would be the best information to keep? The purchaseToken or the orderID?

    I see Unity IAP now returns purchaseToken when we get transactionID.

    However the users receive the order ID on the confirmation emails... When they contact us on support they don't have the purchaseToken, should we start saving both ids?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate, how are you "keeping" this data? I guess the answer would be "keep both".
     
  5. esg-odeoliveira

    esg-odeoliveira

    Joined:
    Feb 3, 2020
    Posts:
    2
    Hey Jeff,

    I'm having the same problem here.
    This is causing issues with our backend receipt validation. Which property should we use now?

    Thanks
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  7. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    We keep the order ID because that's the info the users have regarding their purchases, when any issue happens and they contact us, that is the number they usually send.

    We can only thank Google for using 2 IDs I guess?

    They make us use purchaseToken for all validations and send the order ID to the users...

    We will probably start saving both now, I'm "manually" extracting the order id from the receipt json.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I am looking into this.
     
  9. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    Thanks @JeffDUnity3D , the order id is critical to handle customer support tickets when something isn't right. Was there any update on extracting the order ids when they are available in the newer Unity IAP versions?
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I had asked the team previously, let me check on that. Agreed on your concerns.
     
    eladleb4 likes this.
  11. TeemuTee

    TeemuTee

    Joined:
    Jun 10, 2016
    Posts:
    21
    The receipt JSON contains Payload which in turn contains orderId. This is the GPA version.
     
    Last edited: Feb 18, 2021
  12. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    Thanks, I will manually extract for now it but ideally I'd love to have a convenient way to get it, like we had with the previous versions.
     
  13. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, currently you'll need to extract the OrderID from the receipt. We plan to expose this as a product property in a future release
     
  14. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    Any news about this?
     
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No news, but you can certainly parse the receipt to get the value in the meantime.
     
  16. gagasik

    gagasik

    Joined:
    Jul 29, 2019
    Posts:
    25
    Hi there.

    I've updated the IAP plugin and now the TransactionID in receipt and the purchaseToken in Payload are the same.
    How can I retrieve the TransactionID ?(GPA. ....)
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    From the receipt. In ProcessPurchase, it's in the passed argument as e.PurchasedProduct.receipt
     
  18. Artem-Feoktistov

    Artem-Feoktistov

    Joined:
    Feb 7, 2016
    Posts:
    1
    Could you show some code example how to get the TransactionID from PurchasedProduct.receipt?
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You first want to just inspect the receipt

    Debug.Log("Receipt is " + e.PurchasedProduct.receipt.ToString());

    Then you can use use string methods to parse the receipt https://docs.microsoft.com/en-us/dotnet/csharp/how-to/search-strings