Purchases Being Made Twice When Bought Only Once

The title should be really self-explanatory, but basically, whenever I purchase a developer product once, it charges the account and makes the code that processes the receipt run only once (as it should,) however, once you try to purchase it again a few seconds later, the code that processes the receipt executes twice (which gave me double of the item that was only supposed to come out as one.) I tried debugging it by making it so it checks to see if the PurchaseIds are the same but turns out that 2 complete different PurchaseIds are created.

(This is the PurchaseId when you buy it only once:)

(This is the output once you try to buy it a second time:)

I then tried seeing if buying it a third time would make it so it executes the code twice but turns out that it executed the code 3 times (as seen below)

I don’t have a clue how to fix this and every method I’ve looked at isn’t helping. Another issue I have is knowing if this is a Studio error or an error that can also happen in the regular Roblox engine. Can someone help me out?

2 Likes

Did you make sure to return Enum.ProductPurchaseDecision.PurchaseGranted? If you don’t return it, it’ll retry the function later to ensure the user received the product.

2 Likes

Haven’t tried it since I’m not familiar with it, but I’ll add it to the code and see if works properly and let you know the outcome of it.

If you dont return purchase granted it will redo the purchase every time they join until it’s granted. Roblox is super strict on ensuring people get what they pay for so if you return purchase granted when it wasnt, you can get in some pretty big trouble.


I tried adding the code into the function that is called whenever the script that detects purchases is fired. It still happening. The code that processes the receipt is a different one that processes giving the player what they bought. Do I have to use the Enum.ProductPurchaseDecision.PurchaseGranted in the code that processes the receipt or that grants the player the item?

In the ProcessReceipt function. If that doesn’t work, could you show us your code?

Yeah of course, I’ll lyk the results and if it doesn’t work I’ll send it over

@Inconcludable @steven4547466 It worked thanks for your guys help :))

1 Like

Just to add onto what has previously been mentioned you should explicitly return “Enum.PurchaseDecision.NotProcessedYet” if for whatever reason when awarding the purchased goods the awarding fails (this can happen if the player disconnects/some other issue arises), that way when the play rejoins, the server will attempt to award the purchased goods again until the awarding is successful and Enum.PurchaseDecision.PurchaseGranted is returned.

1 Like