AndroidIAPP is a Godot plugin (Android) that makes working with Google Play Billing (Billing Library 8.0) as simple as possible. It supports one-time purchases, subscriptions with different plans, and—most importantly—offers (discounts/deals) for one-time products.
- Download the plugin and place the
androidiappfolder inres://addons/. - Enable the plugin in the menu:
Project -> Project Settings -> Plugins. - Most important: Copy the file
examples/GooglePlayBilling.gdto your project (e.g., to thescripts/folder).
Add the GooglePlayBilling.gd script to Autoload (Singleton) under the name Billing, or simply create a node with this script in your main scene.
In your game script:
func _ready():
# Connect main signals
Billing.connected.connect(_on_connected)
Billing.error_occurred.connect(_on_error)
Billing.product_details_received.connect(_on_products_loaded)
Billing.purchases_updated.connect(_on_purchases_updated)
# Initialize the plugin
Billing._initialize_plugin()
func _on_connected():
print("Connected to Google Play!")
# Request product information (prices, descriptions)
Billing.query_details(["gold_100", "no_ads"], Billing.TYPE_INAPP)Data will arrive in the product_details_received signal.
func _on_products_loaded(products: Array, unfetched: Array, type: String):
for p in products:
print("Product: ", p.title, " Price: ", p.formatted_price)For a regular product, an ID is sufficient. If the product has an offer configured in the Google Play Console, you can pass its token.
# Simple purchase
Billing.buy_inapp("gold_100")
# Purchase with a specific offer (discount)
Billing.buy_inapp("gold_100", "your_offer_token_here")For subscriptions, you need to specify the product ID and the Base Plan ID.
Billing.subscribe("premium_sub", "monthly-plan")Google requires you to confirm purchases; otherwise, the money will be refunded to the user after 3 days.
- Consumables (gold, lives) — need to be "consumed" (
consume). - Non-consumables (ad removal) — need to be "acknowledged" (
acknowledge).
func _on_purchases_updated(purchases: Array):
for p in purchases:
if p.purchase_state == Billing.PurchaseState.PURCHASED:
if "gold_100" in p.products:
Billing.consume(p.purchase_token) # Give gold and consume
else:
if not p.is_acknowledged:
Billing.acknowledge(p.purchase_token) # Activate permanent itemconnected— ready to start.error_occurred(method, data)— something went wrong (e.g., no internet).product_details_received(products, ...)— prices and descriptions received.purchases_updated(purchases)— triggered after a purchase or during active product checks.consumed_success(token)— product successfully "consumed", reward can be granted.
If something isn't working, connect your phone and check the logs via terminal:
adb logcat | grep IAPPCompatibility: Godot 4.3+ (Android Export). Requires the Billing permission to be enabled in export settings.