Hi I am trying to figure out how to implement in App purchases for iOS. I read the documentation like 100 hundred times, here I just can’t get how I can check if a purchase was made. I can buy an item succesful but when closing the app an open it again I have to re purchase it, the docs on Android specify the way to check if an item was purchased but on IOS no.
I am using this code to pirchase an item:
func on_purchase_pressed():
var result = InAppStore.purchase( { "product_id": "my_product" } )
if result == OK:
var timer = Timer.new()
timer.one_shot = true
timer.autostart = true
timer.wait_time = 1
timer.connect(“timeout”,self,”check_events”)
self.add_child(timer)
else:
print(“error”)
func check_events():
while InAppStore.get_pending_event_count() > 0:
var event = InAppStore.pop_pending_event()
if event.type == "purchase":
if event.result == "ok":
print(“item purchased”)
else:
print(“error”)