Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
How to configure IAB plugin for a different store (not the supported ones)? - Gideros Forum

How to configure IAB plugin for a different store (not the supported ones)?

aimoiaimoi Member
edited September 2015 in Plugins
Hello folks,

This is almost the second week that I'm tying to implement IAP in gideros. As I have not made any progress for several days and I've stuck, I've decided to ask for your help.

I have read almost all the guides provided in "http://docs.giderosmobile.com/interface/iab". As it has said "IAB Interface provides Completely same workflow for all In-app Billing frameworks", I'm interested in making In-App purchase from a store called "Cafe Bazaar". The documentations for implementing IAP in this store for native apps is available through here. As you see it's solution is very very similar to one that "Google Play" uses. I have seen these codes inside the example of how to use IAB:
	initializing store, 
	will differ for each store
	but is mandatory to set
--create iab instance based on store you want to use
iab = IAB.new("test")
--provide key(s) needed for the store
iab:setUp("testkey", "testkey2", "testkey3")
--provide list of products you will be using 
--(key is your internal products id, value is store specific product id)
iab:setProducts({p1 = "product1", p2 = "product2", p3 = "upgrade1"})
--which of your products are consumables, 
--that people can buy many times (provide internal product ids)
iab:setConsumables({"p1", "p2"})
But still I have no idea what to do. Also I have uploaded my game's alpha version in the store and I have the "RSA key" and "Product ID".
I was wondering is there a simple way to implement IAB for such a store? If there is, could someone explain a little bit about the steps of implementing it? And if there is not such a simple approach I wonder can I modify "Google Play"'s implementation and make it work with this store? As I said the solutions for native apps looks very similar, So I'm thinking about something like updating some permissions, intents and key fields and use it for "Cafe Bazaar" store.

Thanks very much for your contribution in advance. (:


  • The easiest way is to make copy of this file (https://github.com/gideros/gideros/blob/master/plugins/iab/source/Android/src/com/giderosmobile/android/plugins/iab/frameworks/IabGoogle.java), name it IabCafebazaar
    renamre class to IabCafebazaar too
    And replace the code of Google Billing to Bazaar billing

    Then you can use it from your lua code as
    iab = IAB.new("cafevbazaar")

    Likes: aimoi

    +1 -1 (+1 / -0 ) Share on Facebook
  • aimoiaimoi Member
    edited September 2015
    Thank you for your quick response, but sorry I didn't get the last sentence
    And replace the code of Google Billing to Bazaar billing
    Which I think is the tricky part. What should I exactly replace? I got the all files for "TrivialDrive" example implementing this store IAB. How should I use it and in which files I should make changes in order to configure the interface for implementing the IAB for this store?
  • Well that part depends on the IAP implementation and is specific to system you want to implement.
    Basically, there is no step by step way to do it, but if you say that their system is similar to Google Billing, then probably you can see the similarities between link you provided and your created copy of IabGoogle.java

    But basically you need to wrap methods from interface https://github.com/gideros/gideros/blob/master/plugins/iab/source/Android/src/com/giderosmobile/android/plugins/iab/IabInterface.java

    Likes: aimoi

    +1 -1 (+1 / -0 ) Share on Facebook
  • @ar2rsawseen
    well, I think you are definitely familiar with the "TrivialDrive" application that google has provided to show how it's IAP system works. In "Cafe Bazaar" they have used the same example for showing how their system works. They've said:
    You can use TrivialDrive example app, which is made by Google, to understand the basics of in-app billing and to copy some util files from it into Eclipse (see next step).

    In order to make this example applicable for Bazaar, we changed 2 lines of this example. You can see TrivialDrive's source code here or download it here. Also you can view our 2 lines changes in this commit.
    And as you can see inside the commit they have just changed two lines.
    In the "AndroidManifest.xml" this:
    -    <uses-permission android:name="com.android.vending.BILLING" />
    +		<uses-permission android:name="com.farsitel.bazaar.permission.PAY_THROUGH_BAZAAR" />
    and in the "IabHelper.java" this:
    -        Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    +        Intent serviceIntent = new Intent("ir.cafebazaar.pardakht.InAppBillingService.BIND");
    So as you said I created a copy of "IabGoogle.java" I changed it's name and class name. I used
    iab = IAB.new("cafevbazaar")
    and aslo changed "AndroidManifest.xml" and "IabHelper.java" (which I found at this directory "src\com\giderosmobile\android\plugins\iab\frameworks\google". I deleted the other dependent files which were for other frameworks.

    And now I'm getting the "Unfortunately, Application has stopped" error. I know it could be because of other things so I have started another discussion about that in here.

    By the way, according the those very little differences between "Cafe Bazaar" API and "Google play"'s API, can you do me a favor and tell me is there any other thing that I have to change to make the "IabGoogle" framework applicable to be used by Cafe Bazaar?

    I really and (seriously) deeply will thank you. (:
  • Unfortunately not familiar with TrivialDrive, I implemented google billing by their docs and it was long long time ago

    I would say it should have been better if you would copy src\com\giderosmobile\android\plugins\iab\frameworks\google folder too and name it cafebazaar and do the needed changes there
    and reference this new package from IabCafebazaar.java

    this way you would be able to use both google billing and cafebazaar iaps (as in having one single apk for both stores)

    About the error, well need to see your logcat output, can't say anything without it, sorry

    Likes: aimoi

    +1 -1 (+1 / -0 ) Share on Facebook
  • aimoiaimoi Member
    edited September 2015
    The LogCat filtered by "System.err" tag and my package name (com.aimdom.aim) is this:
    09-15 17:15:00.810: W/System.err(9032): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.giderosmobile.android.plugins.iab.frameworks.IabCafebazaar" on path: DexPathList[[zip file "/data/app/com.aimdom.aim-1/base.apk"],nativeLibraryDirectories=[/data/app/com.aimdom.aim-1/lib/arm, /vendor/lib, /system/lib]]
    also I have changed the package "com.giderosmobile.android.plugins.iab.frameworks.google" to "com.giderosmobile.android.plugins.iab.frameworks.IabCafebazaar"
  • aimoiaimoi Member
    edited September 2015
    In fact I'm trying to implement the IAB from the "Google Play"'s framework. As I've said their API is very similar to google's. So I tried to use the google's freamwork package for this store. I changed it's name to "com.giderosmobile.android.plugins.iab.frameworks.IabCafebazaar" and I updated "IabHelper.java" file inside the package and "AndroidManifest.xml" and (as ar2rsawseen said) I made a copy from "IabGoogle.java" and changed it's name and class name to "IabCafeBazaar.java". What else should I do?

    Let me clarify this again: The reason I think I can use the google's API for this store with minimum changes, is that their implementation for "TrivialDrive" (a game developed by google to show how google's IAP API works) is very similar. It's just about changing two lines. Check here.
  • Well, what the error says is that app cannot find class IabCafebazaar
    Did you only rename the file or also renamed the class too?
  • aimoiaimoi Member
    edited September 2015
    I did. This is my project's explorer and beside is the "IabCafebazaar.java" file. Should I had to change other things?
  • no that is right, but what is the folder com.giderosmobile.android.iab.frameworks.IabCafebazaar?
    it clashes with the class name, so app probably does not know which one to load
  • emmm.. Now I have tried to implement the "Google Play"s store and I had the same problem. The folder you are talking about is where I keep these:
    image so I don't think I would be able to delete it. I tried to move the "IabGoogle.java" inside the folder (to prevent potential clashes) but still I have the same problem. It stops working with this in LogCat:
    09-15 22:52:04.222: W/System.err(30560): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.giderosmobile.android.plugins.iab.frameworks.IabGoogle" on path: DexPathList[[zip file "/data/app/com.aimdom.aim-2/base.apk"],nativeLibraryDirectories=[/data/app/com.aimdom.aim-2/lib/arm, /vendor/lib, /system/lib]]
    So basically my problem is not about implementing "CafeBazaar", as I have the same problem with google's.
  • What I meant is that you need to rename the folder so it does not have the same name as the class

    And IabGoogle.java and IabCafebazaar should be in frameworks directory
  • aimoiaimoi Member
    edited September 2015
    I tried changing the folder's name and putting back the "IabGoogle.java" in the frameworks directory, too. still having the same problem.
    Now I'm not even trying to implement it for "CafeBazaar" as I noticed I can't even implement it for google.
    I wonder which part I'm not doing right.
    What was @SinisterSoft talking about? should I include some libraries via project properties? I didn't see such a step in the installation part of the guide.
  • The google play 'library' is the play extension, other IAB systems usually have their own library that you put in the libs folder. You then usually have the specific IAB interface to them in the IAB plugin folder and some changes to the manifest.
  • @SinisterSoft
    So you mean I should add "Google play services" to my application via it's properties/add library tools to be able to run my app with plugin?
  • I mean that the store may have an android lib that you also have to include in libs.
Sign In or Register to comment.