Search Unity

[Solved] When to confirm consumables with backend

Discussion in 'Unity IAP' started by Lad-Ty, Oct 5, 2016.

Thread Status:
Not open for further replies.
  1. Lad-Ty

    Lad-Ty

    Joined:
    May 7, 2013
    Posts:
    61
    Hi,

    We have a game that handles verification of incomming receipts on our server. That in short means, that our "ProcessPurchase" always returns "PurchaseProcessingResult.Pending", and we wait for the confirmation from our server that all went well, as in that the server verified that it is a valid payment and it added the ingame currency.
    We also get hundreds of fake payments from various cheaters.

    The manual clearly states:
    "If you are saving consumable purchases to the cloud, you must return PurchaseProcessingResult.Pending and call ConfirmPendingPurchase only when you have successfully persisted the purchase."

    So I would like to ask - if the purchase being processed this way is a fake, should it be marked as Confirmed by calling "ConfirmPendingPurchase" after the server responds in this way, or is it handled in the Unity IAP api internally?
    I am very affraid that if I do not confirm these, the Unity IAP will be calling "ProcessPurchase" on them all the time even though we will always evaluate them as fake, and that it will have a very significant impact on our servers over time.

    Could someone preferably directly from the Unity team advise on dealing with this? Thank you
     
    YanaBiliaieva likes this.
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Hi @Lad-Ty,

    Calling ConfirmPendingPurchase will mark these purchases as Complete and you will not be notified of them again.

    We also have local receipt validation available that may reduce the number of fake payments your server has to deal with:
    https://docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html

    If a receipt is valid, you could mark the Purchase as Pending, then do your server validation, then call ConfirmPendingPurchase to mark it as complete and handle your fulfillment.

    If a receipt is invalid, then you could mark the Purchase as complete and not be notified of it again. No fulfillment has to happen. Marking the Purchase as Complete simply means you have dealt with it and don't need to be notified of it anymore.
     
    RiverExplorer and YanaBiliaieva like this.
Thread Status:
Not open for further replies.