Skip to content

Enabling InApp purchases

Sarsa Murmu edited this page May 13, 2023 · 2 revisions
  • Open AndroidManifest.xml, search for this line
<uses-permission android:name="com.android.vending.BILLING" />
  • If found then it's fine, if not then add this line to your AndroidManifest.xml

Enabling Premium Request

  • Open res/values/dashboard_configuration.xml, find this line
<bool name="enable_premium_request">true/false</bool>

and set it to true

<bool name="enable_premium_request">true</bool>
  • Open Play Console. Open your app
  • Go to Products > In-app products (you can find it on the sidebar)
  • Click Create product
  • Fill up that form. Product ID can be anything.
  • Copy the Product ID
  • Now Open License.java and find these lines
private static final InAppBilling[] PREMIUM_REQUEST_PRODUCTS = new InAppBilling[]{
            new InAppBilling("your.product.id", 1),
            new InAppBilling("your.product.id", 2),
            new InAppBilling("your.product.id", 3),
            new InAppBilling("your.product.id", 4)
};

Now add your products to it. Format is

new InAppBilling("<Product_ID>", <NUMBER_OF_ICONS>)

So, if your Product ID is premium_1 and if an user buys that product they can premium request 5 icons, then you will add

new InAppBilling("product_1", 5)

Add more products if you want, it may look like this

private static final InAppBilling[] PREMIUM_REQUEST_PRODUCTS = new InAppBilling[]{
            new InAppBilling("premium_1", 4),
            new InAppBilling("premium_2", 9),
            new InAppBilling("premium_3", 12)
};
  • You have successfully set premium icon request up.

Enabling Donations

It's almost like premium icon request's setup

  • Open res/values/dashboard_configuration.xml, find this line
<bool name="enable_donation">true/false</bool>

set it to true

<bool name="enable_donation">true</bool>
  • Open Play Console. Open your app
  • Go to Products > In-app products (you can find it on the sidebar)
  • Click Create product
  • Fill up that form. Product ID can be anything.
  • Copy the Product ID
  • Now Open License.java and find these lines
private static final InAppBilling[] DONATION_PRODUCT = new InAppBilling[]{
            new InAppBilling("your.product.id"),
            new InAppBilling("your.product.id"),
            new InAppBilling("your.product.id"),
            new InAppBilling("your.product.id")
};

Now add your products to it. Format is

new InAppBilling("<Product_ID>")

So, If your Product ID is donation_1, then you will add

new InAppBilling("donation_1")

Add more donation products if you want, it may look like this

private static final InAppBilling[] DONATION_PRODUCT = new InAppBilling[]{
            new InAppBilling("donation_1"),
            new InAppBilling("donation_2"),
            new InAppBilling("donation_3"),
            new InAppBilling("donation_4")
};
  • You have successfully set donations up.
Clone this wiki locally