What are purchaseState values 2 & 4

Brother Jared (and anybody else who can help), would you please kindly explain to me what is going on with the blocks I have highlighted with the black rectangle? Why is this part needed for the Restore purchases to work? Thank you beforehand.

Hey @hhuman

See the following:

States 2 and 4 would indicate the user should not have access to that resource.

1 Like

Thank you again, Jared! This is good info.

Related to this Restoration of previous purchases, I see that a variable (purchasedItems) is created as a temporary list in your examples. When the restore button is clicked, app variable purchasedItems is set to empty list. After the check for errors, the actual restoration function is called where you check that empty list for “Remove Ads Forever” (Product Description?). Why are we checking the empty list for the 1 specific item and then inserting it if it isn’t there? Can you help me understand the details of what is going on in the loop that would make this necessary before restoring the item? Thank you again for all of your help!
Screen Shot 2022-03-29 at 11.22.14 AM

This is a way, when unlocking content, to let the user know what is being unlocked. That’s what i’m doing here. I store all the item names in a list (maybe theoretically you have 20). After i set the content to be unlocked in the stored variable, I show the user an alert with a list of all the purchased item.

1 Like

I see, so it’s supposed to show a list of items that have been restored in the message. Correct me if I’m wrong though, since it’s only checking for one productID (pub_remove_ads_1) wouldn’t the list only show 1 item? Thanks again!

You’re not entirely wrong, but I designed the flow as shown so that I could more easily add another product without changing how I display them later. You could display just a single value if you only have 1 product.

1 Like

Got it. This clears it up for me. I will leave it as is just in case I add more productID’s later. Thank you sincerely for all of your help. What a blessing! Learned a lot from you in these posts. Peace brother.

1 Like

Awesome! I’m super happy this is helpful for you!

Have a great week!

1 Like