Search Unity

[Solved] Waiting for receipt validation in ProcessPurchase

Discussion in 'Unity IAP' started by HassanKhallouf, Jul 17, 2016.

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

    HassanKhallouf

    Joined:
    Mar 5, 2015
    Posts:
    52
    Hello everyone,
    I'm implementing unity IAP in a project , and everything is working just fine

    However , as I understood from the docs , int the method ProcessPurchase you have to return either PurchaseProcessingResult.Complete or PurchaseProcessingResult.Pending , you use the later in case something went wrong

    we are doing our validation in our server, so we are sending the receipt to the server, so I need to wait for the result to return before I decide if I will return Complete or Pending

    How can I do this??
    I'm using StartCoroutine for the receipt validation , but I can't wait for it in the ProcessPurchase function because obviously it doesn't return IEnumrator

    thanks in advance
     
  2. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    Hi @HassanKhallouf,

    One thing to not is that Pending does not necessarily mean something went wrong; there are legitimate uses for it even in cases where nothing has gone wrong. This would be a good example of it - you can mark it as Pending while you wait for your server to do receipt validation, then you can mark it as complete in whatever method gets called when your server returns, assuming it returns a successful message.
     
  3. HassanKhallouf

    HassanKhallouf

    Joined:
    Mar 5, 2015
    Posts:
    52
    ok I get it , that's even better than waiting , but how can I mark it as complete?
    should I use ConfirmPendingPurchase to mark it ?
     
  4. HassanKhallouf

    HassanKhallouf

    Joined:
    Mar 5, 2015
    Posts:
    52
    Actually never mind :) , I used the function and flow is perfect now
    thanks erika
     
    erika_d likes this.
Thread Status:
Not open for further replies.