Skip to main content
Version: 1.0

godot-iap

IAPKit - In-App Purchase Solution
Version

This documentation is for godot-iap v1.0-beta which includes StoreKit 2 for iOS and Google Play Billing v8+ for Android. Native code is powered by openiap.

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

Godot IAP Logo

What is godot-iap?

This is an In App Purchase plugin for Godot Engine. This project has been inspired by expo-iap, flutter_inapp_purchase 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.

We will keep working on it as time goes by just like we did in expo-iap, flutter_inapp_purchase, kmp-iap and react-native-iap.

Key Features

  • Cross-Platform: Unified GDScript API for both iOS and Android
  • StoreKit 2 Support: Full StoreKit 2 support for iOS 15.0+
  • Billing Client v8+: Latest Android Google Play Billing features
  • Type-safe: Complete type safety with GDScript's static typing
  • Signal-based: Event-driven architecture with Godot signals
  • OpenIAP Compliant: Follows the standardized OpenIAP specification

What this library does

  • Product Management: Fetch and manage consumable and non-consumable products
  • Purchase Flow: Handle complete purchase workflows with proper error handling
  • Subscription Support: Full subscription lifecycle management
  • Receipt Validation: Validate purchases on both platforms
  • Store Communication: Direct communication with App Store and Google Play
  • Error Recovery: Comprehensive error handling and recovery mechanisms

Platform Support

FeatureiOSAndroid
Products & Subscriptions
Purchase Flow
Receipt Validation
Subscription Management
Promotional OffersN/A
StoreKit 2N/A
Billing Client v8+N/A

Version Information

  • Current Version: 1.0-beta
  • Godot Compatibility: Godot 4.3+
  • iOS Requirements: iOS 15.0+, Xcode 16+ (Swift 6.0+) (via openiap)
  • Android Requirements: API level 24+ (via openiap)

Quick Start

Get started with godot-iap in minutes:

extends Node

var iap: GodotIap

func _ready():
# Get the plugin instance
if Engine.has_singleton("GodotIap"):
iap = Engine.get_singleton("GodotIap")
_setup_signals()
_init_connection()

func _setup_signals():
iap.purchase_updated.connect(_on_purchase_updated)
iap.purchase_error.connect(_on_purchase_error)
iap.products_fetched.connect(_on_products_fetched)

func _init_connection():
var result = iap.init_connection()
print("Init connection: ", result)

Fetch Products

func _on_init_success():
var product_ids = ["your.product.id", "your.premium.subscription"]
var skus_json = JSON.stringify(product_ids)
iap.fetch_products(skus_json, "inapp") # or "subs" for subscriptions

func _on_products_fetched(products_dict):
if products_dict.get("success", false):
var products_json = products_dict.get("productsJson", "[]")
var products = JSON.parse_string(products_json)
for product in products:
print("Product: ", product.title, " - ", product.displayPrice)

Handle Purchases

func purchase_product(product_id: String):
var params = {
"sku": product_id,
"ios": { "quantity": 1 },
"android": { "skus": [product_id] }
}
iap.request_purchase(JSON.stringify(params))

func _on_purchase_updated(purchase_dict):
var product_id = purchase_dict.get("productId", "")
var purchase_state = purchase_dict.get("purchaseState", "")

if purchase_state == "purchased":
# Verify on your server, then finish
iap.finish_transaction(JSON.stringify(purchase_dict), true)

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

Start Building Today

Community & Support

This project is maintained by hyochan.


Ready to implement in-app purchases in your Godot game? Let's get started!