Search Unity

[Solved] Unity 5.3 IAP need help

Discussion in 'Unity IAP' started by Choppa, May 26, 2016.

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

    Choppa

    Joined:
    Jan 17, 2015
    Posts:
    5
    Hello there currently I'm using soomla IAP and soomla is getting discontinued so i wanna switch to Unity IAP.
    So, what i want know is how to lock and unlock item like car/character with a code
    this is how i do it with soomla

    Update ()
    {
    int redcar = StoreInventory.GetItemBalance("red_car");
    if (redcar == 1)
    {
    redcar.GetComponent<Button>().enable = true;
    locked_image.GetComponent<Image>().enable = false;
    }
    }

    Soomla knows that 0 is not owned and 1 is owned
     
  2. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Unity IAP does not maintain a purchase database for you, though there are third party solutions on the Asset store that can assist with this.

    Is red_car a non consumable? If so you can check whether the user has a valid receipt for it, see the receipt validation guide.
     
  3. Choppa

    Choppa

    Joined:
    Jan 17, 2015
    Posts:
    5
    Yes red_car is non consumable and thank you for response so, under receipt i should save with playerprefs when something is unlocked and have it locked by default?
     
  4. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    If it is a non consumable then you don't need to save to playerprefs; you can use the receipt validation library to parse and validate the receipt and figure out if the player is entitled to it; receipts are permanently available for non consumables.
     
  5. rayw24

    rayw24

    Joined:
    May 23, 2016
    Posts:
    52
    @Choppa, yes, saving it in playprefs would work.

    Please let me know if you have any more questions :)
     
Thread Status:
Not open for further replies.