Search Unity

[Locked] Announcement: Codeless IAP for Unity IAP

Discussion in 'Unity IAP' started by nicholasr, Nov 28, 2016.

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

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    I noticed that IAPButton now has a Restore option turning it into a restore purchases button. Though I didn't see this mentioned anywhere in the change log. When was this feature added?
     
  2. Garmien

    Garmien

    Joined:
    Mar 23, 2016
    Posts:
    1
    I recently tried the codeless IAP, however when testing on iOS device i get the following error:
    Purchase failed because Purchasing was not initialized correctly.
    I created a button in my canvas, attached an IAPButton script to it, and set up the catalog product as according to my itunes connect info.
    Google wasn't any help in this case.
     
    ina and Barquest like this.
  3. MasiaT_max

    MasiaT_max

    Joined:
    Feb 22, 2016
    Posts:
    1
    Hello! My IAP works very strange... IAP is working , but in-game currency sometimes added after purchase and sometimes not. Why can it be?
     
  4. cdarklock

    cdarklock

    Joined:
    Jan 3, 2016
    Posts:
    455
    I am kind of confused about the IAP. On certain platforms, you have to go through their store. But if you're not on those platforms, what store do you go through? What is the recommended payment processor for a standalone Windows game?
     
    User340 likes this.
  5. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    How do you test codeless IAP so the fakestore is always fresh each time game is run?

    My purchases remain active after testing a successful purchase but I'd like for the store to let me test purchases each time I hit play.

    My product is a non-consumable.

    Thanks

    UPDATE:
    Using the editor, not actual devices.
     
    Last edited: Mar 14, 2017
  6. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Delete and reinstall the app.
     
  7. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    hi there, i can t find the iap codeless button, the doc says
    1. To add an IAP Button to your scene, in the Unity Editor menu, select Window > Unity IAP > Create IAP Button.

    2. Select the new IAP Button, locate the IAP Button component in the Inspector (see image A, above), and click the AP Catalog…button to open the IAP Catalog window (see image B, below). Alternatively, in the Unity Editor menu, select Window > Unity IAP > IAP Catalog.

      but it s not on unity 5.5.2 in my case

      do i need to add some extra plug in or do i miss something?

      thanks
     
  8. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392

    I meant in the editor.

    Sorry for my not being clear.
     
  9. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392

    Did you import the IAP packages? If you haven't you need to go to services in the editor, find IAP and click on import.
     
    toto2003 and ap-unity like this.
  10. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    aaaah, sorry i didnt realize i needed to import the iap package through the service. silly me. thanks gegagome
     
  11. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    How are you keeping track of purchased products?
     
  12. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
  13. Amonsat

    Amonsat

    Joined:
    Mar 26, 2015
    Posts:
    8
    Doesn't have "Export to csv" function for Google play market
     
  14. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    A Restore Button option was added in a recent version of the IAP plugin. In the IAPButton component, there is now a Button Type parameter that can be changed between Purchase and Restore.

    ===

    High levels of Unverified Revenue are often due to fraud. I gave a description of possible causes of Unverified Revenue in this thread:
    https://forum.unity3d.com/threads/huge-revenue-reported.455662/#post-2992424

    ===

    That is not available in Codeless IAP, but I have added it as a feature request.

    Would you be able to submit a support ticket about this issue? If you could provide a project where this issue is reproduced, that would be helpful.
    https://analytics.cloud.unity3d.com/support/

    ===
    Yeah, this is not expected behavior. We have gotten a couple of reports of this. Would you also be able to submit a support ticket, including an app where this behavior is happening would be very helpful.
    https://analytics.cloud.unity3d.com/support/
     
  15. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    1.10.0

    Could you try: Window -> Unity IAP -> Create IAP Button
    Does that give you the same error?

    Would you be able to share your purchase script? Unity IAP does not handle any inventory management, so the product fulfillment would depend on what you have determined for your app.

    Unity IAP is basically a wrapper for various Store APIs. So without a Store API, there isn't anything for Unity IAP to do. We do allow you to extend the IAP system, so you can use the same code with a custom Store:
    https://docs.unity3d.com/Manual/UnityIAPImplementingAStore.html

    I have made a note of your feature request though. It's one we have heard before, so it's good to know there is interest in support for more platforms.

    Are you clearing the ownership of the item in your code? For example, if you are saving your item in the file system, are you deleting that file when you restart in Play mode. It actually might be a good idea to have a button dedicated to clearing your product data from the filesystem, so you can debug purchases a bit easier.

    That is a bug that should be fixed in a future version. Thanks for reporting this.
     
  16. cdarklock

    cdarklock

    Joined:
    Jan 3, 2016
    Posts:
    455
    It's not really a feature request. I'm wondering what people do for IAP on standalone Windows. I know you can implement a payment integration, but there are a shedload of options once you leave mobile platforms. On iOS, you use Apple. On Android, you use Google. With a UWA, you use Microsoft. What if you just have... a game? Like, what if it's on Linux, and there's no central company to offer a store in the first place?

    The feature of being able to integrate whatever platform you want is already there, but what platforms are people successfully integrating, and how much time and effort is needed to integrate them? Can you, say, wrap the PayPal API and get it working in a day or two? Or do you need something PayPal doesn't have? Does it just take more time, because of reasons?
     
  17. again

    again

    Joined:
    Mar 3, 2013
    Posts:
    21
    Hi,
    I created live wallpaper for android in Unity and am trying to use Unity IAP in it. I tried the API, but as it was not working, I tried that codeless approach too just to be sure.

    The reason for the Unity API not working here seems to be that it uses the standard way of getting context from unity player activity, but unfortunatelly live wallpapers doesnt have an activity, they run as services.
    Why do I think so ? Well I had to deal with the same problem with opening URLs from live wallpaper and now, for the IAP i get this error in logcat:
    Code (JavaScript):
    1. 03-25 23:35:35.682: I/Unity(1526): AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
    2.  
    I think its quite clean, but feel free to correct me if Im wrong.

    My question is:
    Can the Unity IAP as it is be somehow used to work on android without activity ?

    If not, is there any chance to access the UnityEngine.Purchasing classes so I can modify the method of getting context myself ?

    Thanks
     
  18. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @again,
    Using Unity IAP with Live Wallpapers is not a scenario we test for, so it's likely that it is not possible, for the reason you suggest. We don't currently have any plans to support this scenario (or to release the IAP source code.)

    I did find an example of using In-App billing with Live Wallpapers. It isn't Unity-specific, so it may not be terribly useful, but it might give some insight into what is necessary:
    https://www.gaffga.de/implementing-in-app-billing-for-android/
     
  19. TobyYe

    TobyYe

    Joined:
    May 25, 2013
    Posts:
    24
    @ap-unity I try: Window -> Unity IAP -> Create IAP Button
    But I still get the error "Purchase failed because Purchasing was not initialized correctly." Both on ios and android device. It works fine in editor.
    Do I need to publish my game to test the iap?
     
    ExperiorDigital likes this.
  20. BradHoward

    BradHoward

    Joined:
    Jan 14, 2017
    Posts:
    3
    With the newly added 'Restore' option on the Codeless IAP button, how do you get this to work with IOS ?
    I can purchase non-consumables fine, but they are not restored.

    Clicking the 'Restore' button does request itunes (sandbox) login, but afterwards non of the IAP's seem to be restored.

    You can click the buy IAP button and it will tell you that you already own it and can get it for free, but this is not what is required.

    What steps am I missing using the new restore option?

    All non-consumables are set up with Codeless IAP button. Restore button is set up with Codeless IAP button.
    How do I make the Restore Button run through and unlock all non-consumables that have previously been purchased?

    Thanks in advance
     
    susantio likes this.
  21. again

    again

    Joined:
    Mar 3, 2013
    Posts:
    21
    Ok, thank you very much for your response and provided informations. Ill look in the example, thanks for tip.
    Have a nice day ;-)
     
  22. susantio

    susantio

    Joined:
    Jul 14, 2009
    Posts:
    100
    The codeless restore button is not working for me either. In IOS both sandbox and testflight the button doesn't seem to do anything. It does ask for username and password if you completely log out of itunes but pressing that doesn't restore any purchases nor give any further dialog.

    I'm using the latest unity 5.5, IAP 1.10.0, testing on iPad running iOS 10.2.1
     
    Last edited: Mar 30, 2017
  23. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    The restore button, in my case, unlocks previously purchased products when app starts. This is because (I assume) the purchase button has a call to unlock content.
     
  24. BradHoward

    BradHoward

    Joined:
    Jan 14, 2017
    Posts:
    3
    Do you have this working on iOS? if so what exactly are you doing?
     
  25. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    I made a non-codeless sample project just for testing but I've meaning to make one with the codeless buttons. Let me make one tonight and I will send it through here.

    Back to your question; I must say that I am not doing anything especial to be honest. All I notice is that when app starts the IAP product gets restored automatically. Possibly because it calls the function in the purchase button. @ap-unity can provide more insight about this.
     
  26. bobolana

    bobolana

    Joined:
    Nov 30, 2012
    Posts:
    4
    "Purchase failed because Purchasing was not initialized correctly." - on iOS i get the same error with button created with Window -> Unity IAP -> Create IAP Button.. very strange ..the IAP was working and the app is published on the store.. then i just decided to test again the IAPs with the sandbox when this started to happen
     
    ExperiorDigital likes this.
  27. susantio

    susantio

    Joined:
    Jul 14, 2009
    Posts:
    100
  28. TobyYe

    TobyYe

    Joined:
    May 25, 2013
    Posts:
    24
    I encounter ""Purchase failed because Purchasing was not initialized correctly." both on ios and android before. It turn out that I set may store id overwrite wrong. I change the overwrite id for ios and android. Now ios works fine but android still got "Purchase failed because Purchasing was not initialized correctly.". How you guys setup the overwrite store id? something like "xx_xx.remove_ads" you setup on google play?

    And also I setup window->unity iap->android->google play, no use.
     
    Last edited: Apr 1, 2017
    ExperiorDigital likes this.
  29. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    ap-unity likes this.
  30. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Thank you!
    It worked File.Delete(filenamehere);
     
    ap-unity likes this.
  31. PanicEnsues

    PanicEnsues

    Joined:
    Jul 17, 2014
    Posts:
    187
    On iOS, codeless IAPs "Restore" seems to work in that previously purchased non-consumables are restored; however, the notification method that I'm passing to the IApple extension is never being called.

    Based on the sample code at the bottom of this Unity docs page I'm calling:

    public void RestorePurchases()
    {
    IAppleExtensions extensions = IAPButton.IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<IAppleExtensions>();
    extensions.RestoreTransactions(TransactionsRestored);
    }

    private void TransactionsRestored(bool success)
    {
    Debug.Log("Restore complete. Success: " + success);
    }


    When I run that on iOS restoration occurs, but TransactionsRestored is never called. Console output show:

    2017-04-23 20:18:29.968659 <app name>[341:28723] UnityIAP:restoreTransactions
    2017-04-23 20:18:29.968836 <app name>[341:28723] UnityIAP:RestorePurchase
    2017-04-23 20:18:29.970232 <app name>[341:28723] UnityIAP:restoreTransactions
    2017-04-23 20:18:29.970474 <app name>[341:28723] UnityIAP:RestorePurchase
    2017-04-23 20:18:29.970715 <app name>[341:28723] <SKPaymentQueue: 0x174016f40>: Ignoring restoreCompletedTransactionsWithApplicationUsername: because already restoring transactions
    2017-04-23 20:18:30.718418 <app name>[341:28723] UnityIAP:UpdatedTransactions
    2017-04-23 20:18:30.721699 <app name>[341:28723] UnityIAP:paymentQueueRestoreCompletedTransactionsFinished
    2017-04-23 20:18:30.734303 <app name>[341:28723] UnityIAP:Finishing transaction 1000000292848509
    Transactions restored: True
    UnityEngine.Purchasing.IAPButton:OnTransactionsRestored(Boolean)
    UnityEngine.Purchasing.AppleStoreImpl:processMessage(String, String, String, String)
    UnityEngine.Purchasing.Extension.UnityUtil:Update()


    -Scott
     
  32. Bloop-Games

    Bloop-Games

    Joined:
    Feb 8, 2017
    Posts:
    1
    Hi,
    We're using Unity 5.5.0p3 and Codeless IAP (1.10.1) on our iOS game.
    Few days ago, everything was fine but today our IAP prices for EU are wrong.
    iTunesConnect and Unity IAP Catalog is set on Tier 1.

    On iPhone, the price is 1.99€ instead of 1.09€ (new Europe Tier 1 price).

    It seems that Unity doesn't handle the new Apple Tier very well:
    Tier 1: 1.09€
    Alternate Tier A: 0.49€
    Alternate Tier B: 0.99€
    Alternate Tier 1: 1.99€

    Instead of using new Tier 1 (1.09€), Unity use the alternate Tier 1 (1.99€).
     
    Last edited: May 3, 2017
  33. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @Bloop-Games

    Unity IAP pulls all of the product metadata (including title, description and localized price) from Apple during initialization. We pull this data from SKProduct in Storekit:
    https://developer.apple.com/reference/storekit/skproduct

    If your price is correct in iTunes Connect, then it may be worth raising a support ticket with Apple that the price in iTunes Connect does not match what is returned from SKProduct.
     
  34. yaorao

    yaorao

    Joined:
    May 6, 2017
    Posts:
    3
    我想让Google在应用程序中付款,将签名包装和安装后使用的代码写入Android手机。但是要启动初始化,不退出。点击购买并提示未初始化。你能告诉我如何解决这个问题问题是因为我没有直接提交给Google的背景包装后才能正常运行吗?
     
  35. TobyYe

    TobyYe

    Joined:
    May 25, 2013
    Posts:
    24
    how to localized price in codeless iap button.
    I call this and return 0;
    priceText1.text = IAPButton.IAPButtonStoreManager.Instance.StoreController.products.WithID("1500Coins8bullets").metadata.localizedPriceString;
     
  36. TobyYe

    TobyYe

    Joined:
    May 25, 2013
    Posts:
    24
    hi, how you get localized price in codeless iap button?

     
  37. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @tobytarottstudio

    If you are trying to update your UI to include the localized price, you can use the text fields that are included in the IAPButton component. Just drag your UI objects to the appropriate spots on the component. For example:


    iap_text1.png

    Now when playing your game, you will see that the product metadata is used to update those text elements. (In the Editor, the metadata can be configured in the IAP Catalog.)

    iap_text2.png


    If you just want to get the localized price of an item in code, then you can get that from the product itself.
    https://docs.unity3d.com/Manual/UnityIAPBrowsingMetadata.html
     
  38. nicholasr

    nicholasr

    Joined:
    Aug 15, 2015
    Posts:
    183
    I apologize for the late reply @yaorao .. a response from another team member @unityjingyao :

    Google Play does not allow publishers to buy their own products. Besides, you need to install the app from the store (or side load it on top of an app installed from the store) to test IAPs.

    Other causes of IAP initialization failure:

    If your phone was purchased in mainland China, it means that your phone does not have Google services installed. You must install the necessary Google services. You can search for “Google Services Installer” in any app store, it can help you install all Google services automatically.​


    Chinese version:

    谷歌不允许发布者购买自己的商品。另外,你需要从Google商店安装你的应用,或者覆盖安装从Google商店下载并安装的应用。

    其他导致IAP初始化失败的原因:

    如果你的手机是在中国大陆购买的,那就意味着你的手机没有安装谷歌服务。你必须安装所需的谷歌服务才可以使用。你可以在应用市场搜索“谷歌服务安装器”,它可以帮你自动安装所有的谷歌服务。​


    Best,
    Jingyao​
     
  39. -Aymeric-

    -Aymeric-

    Joined:
    Oct 21, 2014
    Posts:
    110
    Hello,

    I'm using codeless IAP and really love how easy is it!

    I've some animations on my buttons, and I want to trigger them only when I received the IAP content. So there isn't fake/undated content during some time (while I don't have those informations, the whole button is transparent).
    Unfortunately, the button doesn't provide an UnityEvent for OnInitialized method. I could modify the IAPButton class, but it wouldn't be a good practice since this code can upgrade itself. So what will be the best way to do it?

    Sounds like the IAPButtonStoreManager class should send Event/Action?
     
  40. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @-Aymeric-

    I shared this suggestion to the IAP team and they thought it sounded like a good idea. I can't say when this would be implemented, but it is something we can do.

    In the meantime, you could modify the IAPButton class, as you suggested, and then rename it. This will prevent it from being overwritten when the plugin is updated.
     
  41. PaulNK

    PaulNK

    Joined:
    Apr 8, 2015
    Posts:
    27
    I’m targetting Android and iOS and just have a couple of questions regarding the Codeless IAP. My game has a local save so I’m not returning PurchaseProcessingResult.Pending.

    1: It looks like the buttons are removed from the IAPButtonStoreManager on disable. Does this mean I need to disable exiting from the store until I get onPurchaseComplete / onPurchaseFailed (otherwise the user could be charged but not receive the reward). Or does the confirm purchase dialog not close until it’s ready to call onPurchaseComplete / onPurchaseFailed?
    2: If the game crashed in ProcessPurchase() would the user be charged or do they only get changed when ProcessPurchase() returns Complete. If it does charge the user will it call ProcessPurchase() again when they view the store?
    3: Is it possible to store custom metadata in a purchase? For example, I buy a non consumable that unlocks a car and restore the purchase after a reinstall. The game has multiple cars so instead of creating a product for every type of car I’d like to be able to just create a car product and pass the car type during the purchase.
     
  42. -Aymeric-

    -Aymeric-

    Joined:
    Oct 21, 2014
    Posts:
    110
    @ap-unity good to know it might come one day :)
     
  43. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @PaulNK

    Only active buttons can receive callbacks. It would be best to keep the UI active until you have received the appropriate callback.

    We are working on a feature that should be available in an upcoming version of the plugin. It will basically be a listener without the UI component, so you can keep that active without showing any buttons.

    This diagram details the Purchase flow. As you can see, ProcessPurchase is called after the user is charged. However, if the app crashes before returning PurchaseProcessingResult.Complete, then the Purchasing system still has a record of that unfinished transaction. And during the next app start (when the Purchasing system is next initialized), the purchasing system will again call ProcessPurchase for that transaction.

    PurchaseProcessingResult.Complete.png
    Source: https://docs.unity3d.com/Manual/UnityIAPProcessingPurchases.html

    Currently, there is no way to store this kind of metadata in Unity IAP purchases. We understand it is a useful feature and we are working on some improvements to our system to allow for this, but I can't say for sure when it will be available.
     
    PaulNK likes this.
  44. -Aymeric-

    -Aymeric-

    Joined:
    Oct 21, 2014
    Posts:
    110
    Hey @ap-unity, I've some questions concerning the restore button :

    I already make some IAP with pure code in other frameworks. The first thing to do is when the game started, ask for IAP products list, no matter if the shop is visible or not. So I added an invisible button on my first scene. Is it correct?

    - on Android, we shouldn't add a restore button. So how do we know a non consumable item has been restored? I mean, on my invisible button something should magically happen??

    - on iOS, I press the restore button but its final method is:
    Code (csharp):
    1.  
    2. void OnTransactionsRestored(bool success)
    3. {
    4.     Debug.Log("Transactions restored: " + success);
    5. }
    6.  
    How can I know which items has been restored?

    Also since the latest update 1.13.1 adding to OnPurchasedFailed event the IAPButton.OnPurchaseFailed make an infinite loop in the editor and on iOS device.
     
  45. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Yes, if you are using Codeless IAP you will need an active button for each product in your catalog and those buttons do not need to be visible.

    On Android, Restoration happens automatically. The non-consumable products will go through the normal ProcessPurchase method when a restoration is detected. You don't need to do anything special to handle this case.

    (Also, it's worth mentioning that Android does not require a Restoration button, but many apps will simply leave the button in for all builds.)

    In general, all non-consumable and auto-renewing subscriptions will be restored.

    Although that's the final place the code calls, it is just for logging purposes. If you look at the full Restore method, you can see the calls to the relevant store extension that actually handles the restoration. And that works just like Google Play, where ProcessPurchase is called for each restored product.

    Code (CSharp):
    1. void Restore()
    2. {
    3.     if (buttonType == ButtonType.Restore) {
    4.         if (Application.platform == RuntimePlatform.WSAPlayerX86 || Application.platform == RuntimePlatform.WSAPlayerX64 || Application.platform == RuntimePlatform.WSAPlayerARM) {
    5.             IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<IMicrosoftExtensions>().RestoreTransactions();
    6.         } else if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.tvOS) {
    7.             IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<IAppleExtensions>().RestoreTransactions(OnTransactionsRestored);
    8.         } else if (Application.platform == RuntimePlatform.Android && StandardPurchasingModule.Instance().androidStore == AndroidStore.SamsungApps) {
    9.             IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<ISamsungAppsExtensions>().RestoreTransactions(OnTransactionsRestored);
    10.         } else if (Application.platform == RuntimePlatform.Android && StandardPurchasingModule.Instance().androidStore == AndroidStore.CloudMoolah) {
    11.             IAPButtonStoreManager.Instance.ExtensionProvider.GetExtension<IMoolahExtension>().RestoreTransactionID((restoreTransactionIDState) => {
    12.                 OnTransactionsRestored(restoreTransactionIDState != RestoreTransactionIDState.RestoreFailed && restoreTransactionIDState != RestoreTransactionIDState.NotKnown);
    13.             });
    14.         } else {
    15.             Debug.LogWarning(Application.platform.ToString() + " is not a supported platform for the Codeless IAP restore button");
    16.         }
    17.     }
    18. }
    You can see more details in the Manual:
    https://docs.unity3d.com/Manual/UnityIAPRestoringTransactions.html

    How are you setting up this event? From your description, it sounds like you are adding the callback function as a callback to itself, which would result in an infinite loop.
     
  46. -Aymeric-

    -Aymeric-

    Joined:
    Oct 21, 2014
    Posts:
    110
    Thanks for the clarification. The documentation says:
    On platforms that support it (e.g. Google Play and Universal Windows Applications) Unity IAP automatically restores any products the user owns during the first initialization following reinstallation; the ProcessPurchase method of your IStoreListener will be called for each owned item.

    When I created IAP button, I've added this simple callback:
    Code (csharp):
    1.  
    2. public void OnPurchaseComplete(Product product) {
    3.  
    4.     switch (product.definition.id) {
    5.  
    6.         case "pack_1":
    7.            SaveManager.Instance.saveData.currency.coins += 5000;
    8.            break;
    9.    }
    10. }
    11.  
    This function could not be called automatically from the restore... or I'm missed something.
    To clarify my previous note, it means that my invisible active buttons will magically have their purchase method called if I also link them to my callback? At the moment, I just put the callback on my visible active buttons.
     
  47. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    If you have that function attached the the callback section of the IAPButton component, then that function will be called when the product is restored.

    iapbutton-callbacks.PNG

    You should really only need one set of buttons. You can make them invisible while the purchasing system is initialized and then made visible once that is complete.
     
    Alverik likes this.
  48. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
Thread Status:
Not open for further replies.