How to use Samsung In app Purchase Iap


I have tried to use the SDK Iap since more than a week but I’m stuck in the first steps I have no idea how to move on. Im using the last version Iap6Helper.
I have imported this module to android studio and added the dependencies, but what should I do next?
Lets say I want to sell two consumable items : item a & item b.

  1. where should I add those items on my code? is it on “”? or on another class?
  2. how to launch the buying of item “a” or “b” with just a click?
    My questions may appear like for someone who didn’t try to experience the Iap6Sample, but believe me I really tried very much to understand the code for days, but I couldn’t find a solution, my level isn’t very professional, I also couldn’t find online solution on other sites or videos.
    Thank you for every help I really appreciate it.


After importing the module, my recommendation is to follow this guide:

You will have to go to your activity and call getInstance(), set IAP Operation mode with setOperationMode(). Start with OPERATION MODE TEST. Then call getOwnedList.
For your items, you will first have to register them in Seller Portal dashboard, in the IAP tab. Once they are registered, use the item ID to call startPayment().

I hope this helps.

Hello Gaby, thank you for your precious reply :slight_smile:
Yes I have already read that tutorial, but it was so hard for me to practice it step by step.
Yes I know I have to register items ans subscriptions on the Seller Portal dashboard, but first I have to write the correct code for them using the same Ids for item names.
this is my current code:

mIapHelper = IapHelper.getInstance( this.getApplicationContext() );
mOwnedListAdapter = new OwnedListAdapter(activity, mIapHelper);
mPaymentAdapter = new PaymentAdapter(activity, mIapHelper);

and Im currently stuck here:

I should do like this?

public class ItemDefine {

public static final String item_a = "Item a to buy"; // consumable
public static final String item_b = "Item b to buy"; // consumable


also when I want to launch purchaseProduct():

should I do like this?
for item a: purchaseProduct(ItemDefine.item_a);
for item b: purchaseProduct(ItemDefine.item_b);

I feel like Im close to make my code, I had to make many changes like changing the Mainactivity and make it global for all classes.

Thank you again

I have another problem, I have activated items on the developer portal, but it always tells me that : “Product does not exist in this store” . So did I really did everything right?
or I should everytime launch my app and get it accepted so I can test my iap items?
thank you anyone who could help

Have you added following permission to AndroidManifest.xml?

<uses-permission android:name=""/>