Tracking Developer Product/Gamepass Purchases

Does anyone have any scripts that can track developer product purchases/gamepass purchases?

or does anyone know how to achieve this?

1 Like

Use datastores. In my games I use a DataStore called “PurchaseHistory” which for each purchase stores a table containing the following:

  • item bought
  • id (if gamepass/product)
  • date of purchase
  • price paid

The best part is, you can use this to track purchase of all in game purchases, not just gamepasses/devproducts.

so in the end, you can easily look up all of a player’s purchases, and refund them if needed, even if the product no longer exists!

1 Like

Can you do this with DataStore2?

DataStore2 Saves the same kind of data inputs the normal DataStore saves, so yes. They just use a different technique of storing the data.

1 Like

There’s a code example of product purchase tracking right on the Developer Hub under ProcessReceipt. The thing about this code sample is that it is put in place to prevent ProcessReceipt from granting purchases that have already been processed. This is due to ProcessReceipt’s nature, in which it is called multiple times until a ProductPurchaseDecision is returned (granted or not processed).

As far as game passes go, you will have to take extra measures to track them down. As game passes can be purchased from the website, you will need to check a player for their purchased game passes upon their entrance into the game and track purchased passes, then track any pass purchased in-game.

I don’t find tracking game passes necessary, so it’d be nice if you had a use case to share regarding that. If it’s to determine if a player purchased a pass or not, UserOwnsGamePassAsync is the function you want to use as caching is lenient. 10 second cache for unowned passes, permanent session cache for owned passes.

As far as Developer Products go, it’d be helpful to allow players to access their history or have some kind of accessible method to query their history. This can allow them to hunt down unhonoured purchases and request for compensation or fixes to their data.

Finally, DataStore2 is a module intended to allow better access and functionality. By nature of a DataStore, DataStore2 is certainly also capable of fulfilling purchase tracking operations.

3 Likes