Check if item was purchased In App iOS implementation

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Pelli

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.one_shot = true
           timer.autostart = true
           timer.wait_time = 1

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”)
:bust_in_silhouette: Reply From: yrtv

Use on every app start or user login(depending on app). Don’t ever store purchases yourself, request them from store or payment provider.

Thanks, I had thought to do that but I find it very wrong to restore purchases all the time, and I was thinking of doing it myself

Pelli | 2021-02-16 14:14

Also, If you have no internet connection the restore can’t be made

Pelli | 2021-02-16 16:18


At the moment, there are two iOS APIs partially implemented

You can try to implement on device validation yourself.

From Choosing a receipt validation technique | Apple Developer Documentation

Validating locally requires code to read and validate a PKCS #7
signature, and code to parse and validate the signed payload.

yrtv | 2021-02-16 17:06