[Guide] In-App Billing

This is a complete guide for all those koders who want to integrate In-App billing in their project :wink:

Note : I used billing extension made by @Taifun

STEP 1 : Prepare everything

A. All you need is a Google Play Console, with your merchant account activated !!

B. Select the app in which you want to integrate in-app billing.

C. Choose In-app products under Monetise section


D. Click on Create Product

E. Enter name of your product, for an example - product1, product2, etc

F. Enter Product Details

G. Set the price you want or you can choose the price from your pricing templates


Now save and activate your product and copy the product id, we will use it later in our project

STEP 2 : It’s time for koding :kodular:

A. Components that i used


B. Blocks

C. Explanation

  1. Use start connection block when screen1 is initialized, it will trigger SetupFinished event.


  1. As per google’s new policy, you have to consume or acknowledge the purchase in 3 days may be otherwise your payment will be refunded automatically. so, i suggest you to set the AutoAcknowledge to true and call

a. Product Details - it will trigger Got Product Details
b. Purchased Products - it will trigger GotPurchasedProducts


  1. You can show your price in a label by this block


  1. You can check if the user had purchased the product in the past or not by checking whether the acknowledged list is empty or not.

If the list is not empty it means user had made the purchase in past and if it is empty then user has not purchased it yet

I used the global variable - FIRST_TIME to check whether the user is new or old. if the user is new and just purchased the product then it it will show - Purchase Successful otherwise Purchase Restored if the user is old and reinstalled the application.

Note - Status.text is nothing but just to show that the product is purchased or not, you can replace it by any premium function you want like removing ads from your app.



  1. The button is used to make the purchase. first it checks whether the product is purchased or not . if the product is purchased then it will show an error. so it is better to prevent it by using if and else block.

Now as we have set the autoacknowledge to true, so if the purchase is successful then it will trigger the event - Acknowledged and if the purchase is not successful then it will trigger the event - Error Occurred


  1. Now as the user is new so i’ve to set FIRST_TIME to YES. check the fourth point to know why i used it.


  1. Our final block, i don’t think there is any need to explain it :stuck_out_tongue_winking_eye:



That’s all,

For more information visit this site - App Inventor Extensions: Billing | Pura Vida Apps


  1. I’m unable to find my product id !!
  • look, if you’ve not uploaded your apk then please upload it first in order to create product id. What you need to do is to create your apk integrated with InApp Billing any use any random product id, for ex - “product01”. now after uploading this, use the same product id while creating it in your console. Done :smiley:
  1. Why do i need to buy this extension, can’t i use kodular InApp Billing component?
  • my simple answer is… you can but i don’t suggest you to do so because the library kodular InApp Billing is using isn’t latest and you can’t use it after November 2021 as per google’s policy. Also if you’re thinking to use it before November then please don’t, you will lose your earning as some payments are getting back to the user automatically. I’m telling you this by my experience. :slightly_smiling_face:

If you have any question, feel free to ask

To test your app, change your product id to android.test.purchased

Note- i didn’t find any way of cancelling the purchase after it is refunded. So… that’s all. i’ll add subscription method as well but later.

Thanks to @Taifun for this amazing extension and :kodular: for this amazing platform.

Thank you :blush:


Good guide, thanks for this :+1:

1 Like

Nice and useful guide.

1 Like

thank you :grinning:

thank you very much :grinning:

Hello friend,

  • If I buy this extension, how much will I have to pay via Paypal?
  • I see they sell for $12, do I have to pay a percentage discount fee + 2% is ($14) ?
  • Or do I just have to pay $12?

i’m not the developer of that extension but i got it in $12… don’t know about yours

1 Like

I mean can I pay $12 to get this extension from him, as i have bought many extensions and aia projects they all ask for extra 2% discount i thank you anyway and now i have enough 12$ to pay them .

yes, you can get it in $12 without any extra charge

1 Like

thank you very much

1 Like

Using the in-App-Billing Component of kodular, you will be guided on how to take payment

what do you want to say ?

I am using payment extension. I am uploading this app to google play. After creating the price templates, I am unable to choose the app in which I have used UPI extension.
If I upload this without creating the price template, I think it may be rejected or suspended. So what can I do next??

By the way your guide is best.

first of all, add this billing extension in your project and for product id, you can use any random project id after, for an ex- product1 now after exporting your apk , upload your app on play store. play store will detect the in app billing in your app and then allow you to create in app products. now while creating in app products, use the same product id you used in your project. done !!

Only creating a product ID and not using the full blocks as explained by you, will work ? Won’t play reject or suspend app by saying violence of mimic the app contents ??
Can you help?

And for one block I have to pay 12$. Is there any other option??

What will do with the product id if you don’t have this extension?

you can’t use in app billing by google unless you have this extension

that’s why you didn’t get the option to choose your app as you had not used this extension

no, your app won’t get suspended or rejected. the only problem you will face is you won’t be able to get payment from other countries.