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
0
Question by Chammzy · Jan 21, 2016 at 01:23 PM · androidpluginandroidpluginpurchaseproduct

IAP Plugins on Android Unity Not Working For Me

Hey guys, first post here. I'm having a really nerve-racking issue when it comes to integrating In-App Purchases for my game made for the Android on Unity. It seems like every plugin I try doesn't work out for me, where the purchase window simply won't pop up. I'm thinking this is an issue on my end as I had been trying APIs like OpenIAB, Gamedonia, etc. I've imported the plugins correctly and scripted the purchasing process as instructed.

Could it be something I'm missing on my Google Play Store draft? Here are my In-App Products listed on there (imbedding image doesn't seem to be working)

http://i.imgur.com/ipVtrN7.png

Comment
Add comment · Show 3
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 MFen · Jan 21, 2016 at 03:56 PM 0
Share

I have used OpenIAB in a project and it does work, when I first started implementing IAP it was very frustrating to learn how and not entirely sure whether these plugins work, so at least knowing OpenIAB does work should give you some confidence.

Next, without seeing any of your code all I can guess it that your Id's that you send for your purchases are not matching, but just a guess.

avatar image Chammzy MFen · Jan 21, 2016 at 09:42 PM 0
Share

You are right. After constant troubleshooting I've narrowed the problem down to being my ID for my products under my Google Play Dev Console. Could you give me an example on how to properly reference these in code?

avatar image corn · Jan 21, 2016 at 09:03 PM 0
Share

You cannot test IAP with a draft app anymore, it must be published as Alpha or Beta, and you have to set an alpha test and a tester list.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Nomibuilder · Sep 02, 2016 at 04:12 AM

This is the Example for Soomla IAP

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 using Soomla;
 using Soomla.Store;
 
 public class IAPHandler : MonoBehaviour, IStoreAssets 
 {
     public string removeAdsId;
 
     private VirtualGood noAds;// = new LifetimeVG("Remove Ads", "Feeling Annoyed! Buy this product to remove ads.", removeAdsId, 
                                 //                 new PurchaseWithMarket(new MarketItem(removeAdsId, 0.99f)));
 
     public VirtualGood[] GetGoods() 
     {
         return new VirtualGood[] {noAds};
     }
 
     public int GetVersion(){return 0;}
     public VirtualCurrency[] GetCurrencies(){return new VirtualCurrency[] {};}
     public VirtualCurrencyPack[] GetCurrencyPacks(){return new VirtualCurrencyPack[] {};}
     public VirtualCategory[] GetCategories(){return new VirtualCategory[] {};}
 
     void Start () 
     {
         noAds = new LifetimeVG("Remove Ads", "Feeling Annoyed! Buy this product to remove ads.", removeAdsId, 
                                new PurchaseWithMarket(new MarketItem(removeAdsId, 0.99f)));
 //        noAds = new VirtualGood (products [0].name, products [0].description, products [0].id, 
 //                                 new PurchaseWithMarket(new MarketItem(products[0].id, products[0].price)));
 
         SoomlaStore.Initialize (this);
         
         StoreEvents.OnMarketPurchaseStarted      += OnMarketPurchaseStarted;
         StoreEvents.OnMarketPurchase             += onMarketPurchase;
         StoreEvents.OnItemPurchaseStarted        += OnItemPurchaseStarted;
         StoreEvents.OnItemPurchased              += onItemPurchased;
         StoreEvents.OnRestoreTransactionsStarted += onRestoreTransactionsStarted;
         StoreEvents.OnRestoreTransactionsFinished += onRestoreTransactionsFinished;
     }
 
     public void RemoveAds()
     {
         StoreInventory.BuyItem (removeAdsId, "0.99$");
     }
 
     public void RestorePurchase()
     {
         SoomlaStore.RestoreTransactions ();
     }
 
     public void OnMarketPurchaseStarted( PurchasableVirtualItem pvi ) {
         Debug.Log( "OnMarketPurchaseStarted: " + pvi.ItemId );
     }
 
     public void onMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary<string, string> extra) 
     {
         if (pvi.ItemId.Equals (removeAdsId)) 
         {
             PlayerPrefs.SetString("NoAds", "true");
             GSSdk.Instance.HideBanner();
             Debug.Log("Remove Ads purchased");
         }
     }
     
     public void OnItemPurchaseStarted( PurchasableVirtualItem pvi ) {
         Debug.Log( "OnItemPurchaseStarted: " + pvi.ItemId );
     }
     
     public void onItemPurchased(PurchasableVirtualItem pvi, string payload) {
         Debug.Log( "OnItemPurchased: " + pvi.ItemId );
     }
 
     public void onRestoreTransactionsStarted() 
     {
         Debug.Log ("Restore Transaction Started");    
     }
 
     public void onRestoreTransactionsFinished(bool success) 
     {
         Debug.Log ("Restore Transaction Finished With: " + success);
     }
 }
 
Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

GooglePlayGames plugin path not correct? 0 Answers

Failed to re-package resources after adding unity in-app purchase service 1 Answer

android time cheat plugin problem with broadcastreceiver 1 Answer

BroadcastReceiver onReceive does not work (custom Unity Android plugin) 1 Answer

How to write a java lib for unity as a plugin to make run another android app? 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