What is the best way (in your opinion) to store shop purchases

For Branchline, we use a system for storing products through keys, if the game can find said key, the player own the product.

It’s wrapped into an API where we can just call

Products:PlayerOwnsProduct(Player, ProductKey) --checks a cached array of products fetched at join

However, games such as Stepford Country Railway seem to handle this process differently
image

My question is, how would you go about storing these purchases

Probably just a table with all their recent purchases, inside one datastore.

The way I do it is (instead of checking each asset to see if the player owns it) is when the product is successfully purchased, it is added to an array of item IDs that is then saved to a datastore with the key being the player. When the player loads in, I fetch the table with the key and then insert the table inside a dictionary containing the user info. Then of course if they buy anything in game, I add it to their table in the dictionary and when the player leaves, I save that data to their datastore (instead of in a time interval to limit the number of datastore calls I use). If something failed and was not added to the table, you can have a button that the player presses (restore purchases) then it loops through all product assets in a table and if something is owned by the player but not in their table for the datastore, you add it.