Dev Product ProcessReceipt Concept

Hello there,

I am writing this post in order to know whether I’ve got the concept right.

I’ve read this article: MarketplaceService | Documentation - Roblox Creator Hub

Where it says:
For example, the function is called again for a product when the player joins the game — or even after they have bought something else — unless you return Enum.ProductPurchaseDecision.PurchaseGranted

Let’s say you have this scenario:

function MPS.ProcessReceipt(receiptinfo)
	local playerProductKey = receiptinfo.PlayerId..":"..receiptinfo.PurchaseId
	local plr = game:GetService("Players"):GetPlayerByUserId(receiptinfo.PlayerId)

	if DevProducts[receiptinfo.ProductId] then
		local handler = DevProducts[receiptinfo.ProductId]

		local suc = pcall(handler,receiptinfo,plr)
        if suc then
		    return Enum.ProductPurchaseDecision.PurchaseGranted
        end
	end
end

Let’s say the ‘handler’ function that is being called has a wait(300) in it. The ProcessReceipt will wait after the ‘handler’ function ended and then return the PurchaseGranted. This means that if the player rejoins while the handler is active, the process receipt will be called again when he joins.

Is this correct?

In the example of the article, a datastore is used to determine whether the Purchase was granted or not.
If I have devproducts where I only give the users currency, I see no need to use a datastore as I just return PurchaseGranted instantly after I give them currency. I can also have a datastore save the user’s currency after purchase to make sure that they don’t lose data.

Is this a good way to look at it?

Sorry I published the post when it was half-written but I edited with the full info.