Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by SNSD · Dec 13, 2016 at 06:52 AM · androidinapp purchase

How google play restore In App Purchases

I'm wondering how google play restore in app purchases (NON-CONSUMABLE) if I'am using "playerprefs" to save the state of the product as purchased.

Is it check on UnityEngine.Purchasing InitializePurchasing() if the product was already bought? If then, how is that go to set the playerprefs?

I'am using Unity IAP

  public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args){
             if (String.Equals(args.purchasedProduct.definition.id, pid_bundle_1, StringComparison.Ordinal)){
                        *PlayerPrefs.SetInt(pid_bundle_1, 1);
                        PlayerPrefs.SetInt("paid", 1);*
              }    
             return PurchaseProcessingResult.Complete;
         }






Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
8
Wiki

Answer by YasinJavaid_ · Oct 15, 2019 at 04:40 AM

Hi i use following to restore my IAPs. now google and Unity IAP plugin provide automatic IAP restore but some how automatic restoration of IAPs don't work always so i use this to manually restore my IAPs on button press.

  public void Resore()
  {
        
     if  (m_StoreController.products.WithID("com.your.iap.id.1").hasReceipt)
     {
        // IAP success results. 
     }
      if  (m_StoreController.products.WithID("com.your.iap.id.2").hasReceipt)
     {
        // IAP success results. 
     }
     .
     .
     .
     .
      if  (m_StoreController.products.WithID("com.your.iap.id.N").hasReceipt)
     {
        // IAP success results. 
     }
     

this only works with non consumable and subscriptions.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by hawkzey · May 18, 2017 at 12:37 AM

You feel like you need to do something extra to perform the enabling of already purchased items but you don't.

When the app is deleted or downloaded on a new phone, the IAP's back end process will call the ProcessPurchase Function you have specified from the IStoreListener class on each item being restored(this is saved internally on each players google account). So what ever code was executed for when the player originally bought the item is executed again, there for re-enabling it.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image darkStar27 · Oct 05, 2018 at 01:22 PM 0
Share

I have implemented IAP yesterday and its working fine. But i wanted to check if the purchases the user make are being restored and as I am working on Google Play there is no restore button to implement, the restoration should be automatic. The thing is i haven't used Google Sign In and when I clear the data of the app or delete and reinstall the app from play store, the coins I bought with IAP just wipes out and I just have to buy new coins. (Note: I use Player Prefs to save the coins) I was wondering if i need to upload the save game to Google Play or do i have to use Google Sign In. Can you please help ?

P.S. I am on Internal Testing of the app and have tested the IAP only from a Licence Account.

@hawkzey

avatar image
0

Answer by hexagonius · Dec 13, 2016 at 07:22 AM

this manual page explains how to set up IAP from the start

https://unity3d.com/de/learn/tutorials/topics/analytics/integrating-unity-iap-your-game

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SNSD · Dec 19, 2016 at 09:25 AM 0
Share

ive already read that.. what I am asking is restoring IAP in google play store.. on the manual page it only restore IAP in iOS.. so I am puzzled if it is automatically restored in GOOGLE PLAY without the code provided in the manual page.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

106 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Require In App Billing suggestions for android 2 Answers

In App Purchases for Unity 4.6 0 Answers

Anybody knows android inapp purchase detailed tutorials/documentation? 1 Answer

Is there any way to restore consumable in-app-purchases after uninstalling the app? 4 Answers

How to offer ad-free version of game on android? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges