diff --git a/plugins/inappstore/README.md b/plugins/inappstore/README.md index a2cad0d..022893d 100644 --- a/plugins/inappstore/README.md +++ b/plugins/inappstore/README.md @@ -10,26 +10,35 @@ var _appstore = null func check_events(): while _appstore.get_pending_event_count() > 0: var event = inappstore.pop_pending_event() - match event.type: - 'product_info': - ... - 'purchase': - ... - 'restore': - ... - -func _on_Button_button_down(): - var result = _appstore.restore_purchases() + if event.result=="ok": # other possible values are "progress", "error", "unhandled" + + # print(event.product_id) + match event.type: + 'product_info': + # fields: titles, descriptions, prices, ids, localized_prices, currency_codes, invalid_ids + ... + 'purchase': + # fields: product_id, transaction_id, receipt + ... + 'restore': + # fields: product_id, transaction_id, receipt + ... + +func _on_Purchase_button_down(): + var result = _appstore.restore_purchases() ... var result = _appstore.purchase({'product_id': "product_1"}) ... -... +func _on_Restore_button_down(): # such button is required by Apple for non-consumable products + var result = _appstore.restore_purchases() + ... + func _ready(): - if Engine.has_singleton("InAppStore"): - _appstore = Engine.get_singleton('InAppStore') - var result = _appstore.request_product_info( { "product_ids": ["product_1", "product_2"] } ) + if Engine.has_singleton("InAppStore"): + _appstore = Engine.get_singleton('InAppStore') + var result = _appstore.request_product_info( { "product_ids": ["product_1", "product_2"] } ) if result == OK: print("Successfully started product info request") _appstore.set_auto_finish_transaction(true) @@ -41,8 +50,8 @@ func _ready(): timer.start() else: print("failed requesting product info") - else: - print("no app store plugin") + else: + print("no app store plugin") ``` ## Methods