Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
avnerh1 authored Jul 18, 2021
1 parent d02a042 commit dd76ca3
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions plugins/inappstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit dd76ca3

Please sign in to comment.