In App Billing implementation in Titanium

Posted By : Chandan Wadhwa | 10-May-2016

In-App purchase is a native way to buy product or add some extra features in app. Many time you came into the situation where you were asked to pay for some extra options / features in an mobile App. This are totally optional functionality, but depending on what is being offered we sometimes get new functionality.


In this tutorial i will explain you how to define products for In-App Billing in Google play developer Console and implementation in titanium.


Types of product in Google play developer console :-


  1. Managed :- Managed product are one time service eg :- fish food in a fishing app.

  2. Subscription:- A subscription is a product type offered in In-app Billing that lets you sell content, services, or features to users from inside your app with recurring monthly or annual billing.

Defining In-App Purchase products in Google play developer console :-


  1. Open google play developer console and navigate to your app.

  2. Inside your app visit “In-App Product”. A Screen will appear asking you about the Managed and Subscription product choose any product type as per your requirement.

  3. Fill the product details for Manages or Subscription product.


Initial requirements for In-App Purchases :-

  1. Google Payments merchant account must be activated in google play developer console.
  2. Product must be defined inside your app
  3. Real Device for testing in-app purchase.
  4. Create  signed apk for testing.
  5. ti.inappbilling module.
  6. App must be submit for beta testing for sandbox testing.

Integrating Module code in Titanium App:-

  1. Add ti.inappbilling module in titanium app.
  2. Import module using requite("ti.inappbilling") in controller.
  3. Integratde module code in controller.
  4. Replace PUBLIC_KEY with you app public key.

Inside module code runSetup() function will be called first and after successful setup setupcomplete event will be executed.

After purchase purchasecomplete event will be executed you can execute you payment logic after receiving success response of purchase. 


About Author

Author Image
Chandan Wadhwa

Chandan is an Android Apps developer with good experience in building native Android applications.

Request for Proposal

Name is required

Comment is required

Sending message..