I have noticed that in many code samples in the Developer Hub as well as production environments, the very bottom of a ProcessReceipt function returns Enum.ProductPurchaseDecision.PurchaseGranted. This means that if Enum.ProductPurchaseDecision.NotProcessedYet isn’t returned anywhere in the code, the purchase will be marked as granted.
local function ProcessReceipt(ReceiptInfo)
if not something then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
I’ve just been thinking to myself; isn’t it bad practice to do something like this? A code structure like this means that if you don’t explicitly write conditions where a purchase should be denied, then it’ll be marked as processed.
Improperly written code or lack of handlers for various products could lead to purchases being marked as granted, whether anything happened or not. This could potentially lead to dishonouring of purchases, which falls under scamming. That’s trouble waiting at the corner, as well as moderation.