Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

IAP 2.2.2 - Error with PurchaseProcessingResult.Pending

Discussion in 'Unity IAP' started by fire1991man, Nov 29, 2020.

  1. fire1991man

    fire1991man

    Joined:
    May 31, 2013
    Posts:
    18
    I made a game with server side. I purchase IAP(com.abc.0.99) , it perform successfully, then i send TransitionID to server to verify.
    In function
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args), i return PurchaseProcessingResult.Pending

    During that time, i wait from server, I made the same purchase(com.abc.0.99), It perform successfully too. I think it will be failed still i confirm first purchase
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

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

    fire1991man

    Joined:
    May 31, 2013
    Posts:
    18
    No, in my case, i see only 1 success purchase as i describe above
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please describe the issue that you are seeing, are you receiving an error message?
     
  5. fire1991man

    fire1991man

    Joined:
    May 31, 2013
    Posts:
    18
    I updated the newest version of Unity IAP. I describe step by step my issue

    1. I open app and receive log about Init Unity IAP success like Image 1
    2. I purchase consumable product "com.gameg.windyvillage.0.99" successfully, it has log like Image 2
    3. I purchase product "com.gameg.windyvillage.0.99" again, it show message like Image 3. It's ok because i return PurchaseProcessingResult.Pending in function public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    4. My issue is step 4, i close app and reopen it. UnityIAP show log like Image 4. The product "com.gameg.windyvillage.0.99" don't have Receive ( TransactionID: - Receipt: - Has Receipt: False ). I think UnityIAP must store the transaction of purchase that not complete. In this case, i will use StoreController.ConfirmPendingPurchase to complete Pending Transaction
     

    Attached Files:

    • 1.png
      1.png
      File size:
      58.3 KB
      Views:
      281
    • 2.png
      2.png
      File size:
      130.2 KB
      Views:
      274
    • 3.png
      3.png
      File size:
      250.2 KB
      Views:
      274
    • 4.png
      4.png
      File size:
      58.9 KB
      Views:
      286
  6. MatthieuSmith_Unity3D

    MatthieuSmith_Unity3D

    Unity Technologies

    Joined:
    Oct 16, 2020
    Posts:
    23
    Hello @fire1991man

    Before answering, if you don't mind I'd like to confirm my understanding of the issue.

    So basically you have a purchase that you have returned `Pending` in the `ProcessPurchase` method. Then when you open the app again, you don't see a receipt for your product and you didn't call `ConfirmPendingPurchase` on the purchase.

    Is that correct?
     
  7. fire1991man

    fire1991man

    Joined:
    May 31, 2013
    Posts:
    18
    that's right
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Do you see ProcessPurchase triggered for this Pending transaction on app restart?
     
    MatthieuSmith_Unity3D likes this.
  9. fire1991man

    fire1991man

    Joined:
    May 31, 2013
    Posts:
    18
    I tested again, ProcessPurchase is not trigger. Only OnInitialized triggered
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Do you typically call ConfirmPendingPurchase in ProcessPurchase? Or elsewhere? I'm testing now.
     
  11. fire1991man

    fire1991man

    Joined:
    May 31, 2013
    Posts:
    18
    I want to call ConfirmPendingPurchase in OnInitialized if any product have a receipt. MatthieuSmith_Unity3D describe exactly my issue
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, you would not want to do that. If they have a receipt, they are already confirmed.
     
  13. fire1991man

    fire1991man

    Joined:
    May 31, 2013
    Posts:
    18
    because i develop with server side. I need verify receipt from server. I want to manually ConfirmPendingPurchase
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, I understand you are doing server side receipt validation. We do have an issue to be clear. But you don't confirm all products in initialization, you would expect ProcessPurchase to trigger and that's where you do it, but that's not happening. But you're likely seeing the same thing. Was this working previously for you? I'm using the Sample IAP project here to test, it was designed for this scenario. You can click Toggle to return Pending from ProcessPurchase at runtime https://forum.unity.com/threads/sample-iap-project.529555/
     
  15. fire1991man

    fire1991man

    Joined:
    May 31, 2013
    Posts:
    18
    yah, sorry for scenario, i don't use ConfirmPendingPurchase in initialization. What i want is pending receipt in initialization. In the case, server don't receive my receipt or any bug when i purchased successfully. When app restart, i wil check and send again that receipt is not verify
     
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, you would do this check in ProcessPurchase not initialization on app restart. We are working on sorting this out.
     
    fire1991man likes this.