Monday 22 January 2018

In-App Billing Extension

Description

This extension enables you to use Google In-App Billing in your App Inventor app for Products (both non-consumable and consumable) and Subscriptions.
Required permission: com.android.vending.BILLING

This extension uses the Android In-App Billing v3 library V 1.0.32

Properties


Returns whether In-app billing service is ready to purchase.

Methods


Initialize the In-App Billing service using your licency key and merchant id.
How to get this information, see chapter Preparation for your own app.

Note: The GotOwnItems event will be fired automatially after using that method.

Load Own Items.

Purchase Product.
Note: The purchase process takes a few seconds. You have to trigger the method LoadOwnItems to refresh the purchased items. You only can purchase a product once. Then you first have to consume it before being able to purchase it again.

Consume product.
Note: The GotOwnItems event will be fired automatially after using that method.

Subscribe.
Note: The purchase process takes a few seconds. You have to trigger the method LoadOwnItems to refresh the subscribed items. You only can subscribe an item once.

Get Product Details.

Get Subscription Details.

Events


Event indicating that own items have been loaded.
A list of own products and own subscriptions will be returned.

Event indicating that product details have been received.

Event indicating that subscription details have been received.

Event indicating that an error occurred.

Example App 1: As simple as possible

Let's assume, you like to offer a free version of your app and a premium version. After paying a small amount, the user can upgrade to the premium version to get additional features. So there is only one product to buy. After successful purchase, store the status (premium) in TinyDB, so you also can get the correct status of the app (free or premium) also if there is no internet connection. You can test the example using the test product android.test.purchased also in the companion app.


If you want to test again, first consume the product and clear the tag premium in TinyDB.

Screenshot:










   

No comments:

Post a Comment