Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Easy IAP - Make money from your game

Discussion in 'Assets and Asset Store' started by GleyGames, Oct 16, 2018.

?

What other platforms we should create support for?

  1. Amazon Apps

  2. Amazon Underground

  3. CloudMoolah Store

  4. Mac App Store

  5. Samsung GALAXY Apps

  6. Tizen Store

  7. Windows Store

Multiple votes are allowed.
Results are only viewable after voting.
  1. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    121
    Easy IAP (In App Purchase)
    Make money from your game
    large.jpg

    Get it now from Asset Store
    For detailed implementation instructions see the Documentation


    Key features:
    • Make in app purchases with minimal setup and very little programming knowledge.
    • Same code for all supported platforms.
    • Just import Easy IAP and add your product IDs and all is done.
    • Can be tested using Unity Editor.
    • Support for Consumable. Non-Consumable and Subscriptions.
    • Easy setup for in app products using a custom made Setttings Window.
    • Works with Unity 5.3 and above and with Free, Plus or Pro versions of Unity.
    Currently supported platforms:
    • Google Play
    • App Store (iOS)
    • Amazon Store
    Easy setup from a custom Editor Window:

    addProducts.jpg
    Simple methods to make a purchase that work for all platforms:
    • Initialize plugin
    Code (CSharp):
    1. //call this method only once at the beginning of the game to initialize product information.
    2. IAPManager.Instance.InitializeIAPManager(InitializeResultCallback);
    3.  
    4. //this method will be called after initialization process is done
    5. private void InitializeResultCallback(Status status, string message, List<StoreProduct> shopProducts)
    6. {
    7.      if (status == Status.Success)
    8.      {
    9.           //IAP was successfully initialized
    10.           //loop through all products
    11.           for (int i = 0; i < shopProducts.Count; i++)
    12.           {
    13.                if (shopProducts[i].productName == "YourProductName")
    14.                {
    15.                     //if active variable is true, means that user had bought that product
    16.                     //so enable access
    17.                     if (shopProducts[i].active)
    18.                     {
    19.                          yourBoolVariable = true;
    20.                     }
    21.                }
    22.           }
    23.      }
    24.      else
    25.      {
    26.           Debug.Log(“Error occurred ”+ message);
    27.      }
    28. }
    • Buy product
    Code (CSharp):
    1. IAPManager.Instance.BuyProduct(ShopProductNames.YourProductName, ProductBoughtCallback);
    2.  
    3. // automatically called after one product is bought
    4. // this is an example of product bought callback
    5. private void ProductBoughtCallback(Status status, string message, StoreProduct product)
    6. {
    7.      if (status == Status.Success)
    8.      {
    9.           //each consumable gives coins in this example
    10.           if (product.productType == ProductType.Consumable)
    11.           {
    12.                coins += product.value;
    13.           }
    14.  
    15.           //non consumable Unlock Level 1 -> unlocks level 1 so we set the corresponding bool to true
    16.           if (product.productName == "UnlockLevel1")
    17.           {
    18.                unlockLevel1 = true;
    19.           }
    20.  
    21.           //subscription has been bought so we set our subscription variable to true
    22.           if (product.productName == "Subscription")
    23.           {
    24.                subscription = true;
    25.           }
    26.      }
    27.      else
    28.      {
    29.           //an error occurred in the buy process, log the message for more details
    30.           Debug.Log("Buy product failed: " + message);
    31.      }
    32. }
    • Restore Purchases
    Code (CSharp):
    1. //only required for iOS App Store
    2. //restores previously bought products
    3. //this is also done automatically every time at initialize
    4. IAPManager.Instance.RestorePurchases(ProductRestoredCallback);
    5.  
    6. // this is an example of product restored callback
    7. private void ProductRestoredCallback(Status status, string message, StoreProduct product)
    8. {
    9.      if (status == Status.Success)
    10.      {
    11.           //consumable products are not restored
    12.           //non consumable Unlock Level 1 -> unlocks level 1 so we set the corresponding bool to true
    13.           if (product.productName == "UnlockLevel1")
    14.           {
    15.                unlockLevel1 = true;
    16.           }
    17.  
    18.           //subscription has been bought so we set our subscription variable to true
    19.           if (product.productName == "Subscription")
    20.           {
    21.                subscription = true;
    22.           }
    23.      }
    24.      else
    25.      {
    26.           //an error occurred in the buy process, log the message for more details
    27.           Debug.Log("Buy product failed: " + message);
    28.      }
    29. }
    For a complete list of methods check the Documentation

    Any suggestions are always welcome, we will consider them for future updates.

    We also made some tutorials on how to test your products on Google Play:


    And also for iOS:


    We also made a detailed step by step tutorial on how to create IAP products, upload builds to alpha, test IAP products and create a basic shop in your game. Here is a complete playlist:
    https://www.youtube.com/playlist?list=PLKeb94eicHQumyCLcJbprEgOhyKc2Q7EQ



     
    Last edited: May 7, 2019
  2. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    121
    Version 1.1.0 in now available on Asset Store

    Changes in this version:
    • Fixed compatibility issue with other external packages. Now the plugin is compatible with all other plugins used in your app.
    • Minor fixes in settings window.
     
  3. Adswars

    Adswars

    Joined:
    Jun 28, 2015
    Posts:
    13
    I not sure how RestorePurchase works.
    If user bought more both UnlockLevel1 and Subscription (from example above) then when this command call

    IAPManager.Instance.RestorePurchases(ProductRestoredCallback);

    Which product will restore the purchase?
     
  4. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    121
    Hello,

    Thank you for your interest in our plugins.

    If you call this method it will be restored all product marked as Non Consumable and Subscription.
    The product marked as consumable are not restored.
     
    Adswars likes this.
  5. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    121
    Hello,
    We just extended our plugin with Amazon support.
    You can get it now from the Asset Store
     
    Mailjitu and Adswars like this.
  6. violentlemming

    violentlemming

    Joined:
    Nov 14, 2015
    Posts:
    4
    Hi,

    I have bought 2 of your plugins (Easy IAP and Easy Achievements and Leaderboards),

    I have followed your instructions to the letter and everything builds fine but once the app is deployed to an Android device the game starts and attempts to access google services I get the App has stopped working message.

    Can you provide any assistance on how to resolve the issue?

    Thanks in advance,

    Terry
     
  7. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    121
    Hello,
    Thank you for using our plugins.
    Please connect your app to Android monitor and see what is the reason for the crash then let us know.

    If that is not possible please ad us as a tester for your app using gley.mobi@gmail.com e-mail address and send us your test link and we will debug your app for you to see what went wrong with your implementation.
     
  8. violentlemming

    violentlemming

    Joined:
    Nov 14, 2015
    Posts:
    4
    Thanks for the quick reply :) I have used the Android Monitor and found the APPID was incorrectly configured in the manifest file, in the manifest file the APPID starts with \ but it needs to start with \u003. The Easy Achievements is working like a treat now, next up Easy IAP :)
     
  9. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    121
    We are glad you managed to solve your problem. Let us know if you need more support from us.
    Good luck with your game!
     
  10. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    121
    We just released a step by step tutorial about testing your In App Products on Amazon Store
     
  11. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    121
    Hello,
    You have to reimport Unity IAP. Sometims it fails to install correctly. Please check this tutorial at 1.17.