Donation Board + Dev Products Help (ProcessReceipts)

Hi,

Recently, I fixed a problem where all other dev products wouldn’t work when a donate board was in the game - as there were multiple ProcessReceipts. When I removed the donation board, it worked, but I was wondering how to make both the donation board and other products co-exist in one ProcessReceipt (aka, make both the donation board and dev. product purchases work)? Here is my current code:

local MPS = game:GetService("MarketplaceService")
local http = game:GetService("HttpService")

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1235160688 then
		local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		plr.leaderstats.Gems.Value += 10
		
		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	if receiptInfo.ProductId == 1239862463 then
		local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		plr.leaderstats.Gems.Value += 100
		
	
		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	if receiptInfo.ProductId == 1239862464 then
		local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		plr.leaderstats.Gems.Value += 250

		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	if receiptInfo.ProductId == 1239862465 then
		local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		plr.leaderstats.Gems.Value += 500

		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	if receiptInfo.ProductId == 1239862466 then
		local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		plr.leaderstats.Gems.Value += 5000
		

		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	-- these are robux donos
	
	if receiptInfo.ProductId == 1322432515 then
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	if receiptInfo.ProductId == 1322432639 then
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	if receiptInfo.ProductId == 1322432854 then
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	if receiptInfo.ProductId == 1322432856 then
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	if receiptInfo.ProductId == 1322432855 then
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

You can see the latter portion of the code has purchase info for the donation board - i tried this, however it did not work.

Any help is greatly appreciated!

2 Likes

Hi there,

While you’re on the right track with merging all product purchase handling under a singular ProcessReceipt operation, in order to correctly integrate the donations, you’d need to incorporate the donation board’s functionality from it’s own ProcessReceipt function as well. Presumably, the donation board’s code itself is doing more than just returning PurchaseGranted, possibly something along the lines of updating it’s own DataStore key.

Have a look at how your donation board processed it’s own purchases and then you can think about how would you merge that functionality into your current code.

2 Likes

Thank you, this helped a lot!

I found this line in the comment of the donation board kit. I presume that this is what updates the DataStore and goes in the code?

Just making sure before I blow more 5 robux donations for testing lol. Thanks!

1 Like

This entirely depends on how your donation board functions and if there’s anything else that it does (or has any other datastores that it updates to keep track of purchases, etc.). The best you can do is have a look at your donation board’s receipt handler handler function to see if there are other changes that may need to be made. If you’re provided with any documentation from the board itself, simply follow that.

2 Likes

Thank you for the help. I’ll apply the info in the game!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.