Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Godot IAP - Cross-Platform In-App Purchases

An asset by hyodotdev
The page banner background of a mountain and forest
Godot IAP - Cross-Platform In-App Purchases hero image

Quick Information

0 ratings
Godot IAP - Cross-Platform In-App Purchases icon image
hyodotdev
Godot IAP - Cross-Platform In-App Purchases

Cross-platform in-app purchase plugin following the OpenIAP specification.Features:• Unified API for iOS (StoreKit 2) and Android (Google Play Billing 8+)• Type-safe GDScript API with auto-generated types• Supports consumables, non-consumables, and subscriptions• OpenIAP standard compliance for consistent behavior across platforms

Supported Engine Version
4.3
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
20 hours ago
Git URL
Issue URL

godot-iap

godot-iap logo

README CI README Release README Godot 4.3+ README OpenIAP README License: MIT

A comprehensive in-app purchase plugin for Godot 4.x that conforms to the Open IAP specification

Open IAP

About

This is an In-App Purchase plugin for Godot Engine, built following the OpenIAP specification. This project has been inspired by expo-iap, flutter_inapp_purchase, kmp-iap, and react-native-iap.

We are trying to share the same experience of in-app purchase in Godot Engine as in other cross-platform frameworks. Native code is powered by openiap-apple and openiap-google modules.

We will keep working on it as time goes by just like we did in other IAP libraries.

Documentation

Visit the documentation site for installation guides, API reference, and examples:

hyochan.github.io/godot-iap

Installation

  1. Download godot-iap-{version}.zip from GitHub Releases
  2. Extract and copy addons/godot-iap/ to your project's addons/ folder
  3. Enable the plugin in Project → Project Settings → Plugins

See the Installation Guide for more details.

Quick Start

extends Node

# Load OpenIAP types for type-safe API
const Types = preload("res://addons/godot-iap/types.gd")

func _ready():
    # Connect signals
    GodotIapPlugin.purchase_updated.connect(_on_purchase_updated)
    GodotIapPlugin.purchase_error.connect(_on_purchase_error)

    # Initialize connection
    if GodotIapPlugin.init_connection():
        _fetch_products()

func _fetch_products():
    # Create typed ProductRequest
    var request = Types.ProductRequest.new()
    request.skus = ["coins_100", "premium"]
    request.type = Types.ProductQueryType.ALL

    # Returns Array of typed products (Types.ProductAndroid or Types.ProductIOS)
    var products = GodotIapPlugin.fetch_products(request)
    for product in products:
        # Access typed properties directly
        print("Product: ", product.id, " - ", product.display_price)

func _on_purchase_updated(purchase: Dictionary):
    if purchase.get("purchaseState") == "Purchased":
        # Finish transaction with typed PurchaseInput
        var purchase_input = Types.PurchaseInput.from_dict(purchase)
        GodotIapPlugin.finish_transaction(purchase_input, true)  # true = consumable

func _on_purchase_error(error: Dictionary):
    print("Error: ", error.get("code"), " - ", error.get("message"))

func buy(product_id: String):
    # Create typed RequestPurchaseProps
    var props = Types.RequestPurchaseProps.new()
    props.request = Types.RequestPurchasePropsByPlatforms.new()
    props.request.google = Types.RequestPurchaseAndroidProps.new()
    props.request.google.skus = [product_id]
    props.request.apple = Types.RequestPurchaseIosProps.new()
    props.request.apple.sku = product_id
    props.type = Types.ProductQueryType.IN_APP

    # Returns typed purchase object or null
    var purchase = GodotIapPlugin.request_purchase(props)

License

MIT License - see LICENSE file for details.

Cross-platform in-app purchase plugin following the OpenIAP specification.

Features:
• Unified API for iOS (StoreKit 2) and Android (Google Play Billing 8+)
• Type-safe GDScript API with auto-generated types
• Supports consumables, non-consumables, and subscriptions
• OpenIAP standard compliance for consistent behavior across platforms

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Godot IAP - Cross-Platform In-App Purchases icon image
hyodotdev
Godot IAP - Cross-Platform In-App Purchases

Cross-platform in-app purchase plugin following the OpenIAP specification.Features:• Unified API for iOS (StoreKit 2) and Android (Google Play Billing 8+)• Type-safe GDScript API with auto-generated types• Supports consumables, non-consumables, and subscriptions• OpenIAP standard compliance for consistent behavior across platforms

Supported Engine Version
4.3
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
20 hours ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers