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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

[Solved] Play Store IAP, Questions regarding Consumables and Product Receipts

Discussion in 'Unity IAP' started by LandonC, Jul 13, 2018.

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

    LandonC

    Joined:
    Dec 20, 2012
    Posts:
    83
    I have a few questions regarding google play store purchases.

    So if I want to allow my players to get permanent item once they made a consumable purchase, say they bought 400 gold and they will also receive a 100 additional permanent attack damage.

    Is it okay to check product.receipt to know if the player's account has made a consumable purchase before?

    And if the player made a refund, will the product.receipt still exist on the player's google play account?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    @LandonC Consumable purchases by definition are not permanent, and can be purchased again. I would need to research your questions regarding the product.receipt which I would confirm by explicit testing. Have you tested this and perhaps seeing unexpected behavior?
     
  3. LandonC

    LandonC

    Joined:
    Dec 20, 2012
    Posts:
    83
    Alright, I've checked, no receipt unless it is non-consumable.

    For anyone who is searching for an answer, I used the code that I've found here to check if any existing product is already purchased. It works.

    Code (CSharp):
    1.     public void OnInitialized(IStoreController controller, IExtensionProvider extensions) {
    2.         Debug.Log("Initialized");
    3.         this.controller = controller;
    4.         this.extensions = extensions;
    5.    
    6.         foreach (Product p in controller.products.all) {
    7.             //Non-consumables that have been purchased, should have the purchase info in the receipt.
    8.             Debug.Log(p.receipt);
    9.         }
    10.     }
    11.  
     
Thread Status:
Not open for further replies.