I have setup the ProcessReceipt callback like this. (using Knit framework, thats why you see a : in there)
function GamePassService:ProcessReceipt(receiptInfo)
print("cheetoes are the best!")
print(receiptInfo)
end
MarketplaceService.ProcessReceipt = GamePassService:ProcessReceipt()
When I test in Studio, at server startup the callback fires immediately. It does both prints fine, but the receiptInfo prints nil.
However when I test purchases (in Studio) I get all the popups and confirmations from Roblox, but the callback never fires.
How do you test dev products in studio if the callback will not fire?
That instantly calls the function, you probably meant to do MarketplaceService.ProcessReceipt = GamePassService.ProcessReceipt, although you would be missing the self argument.
So you will need something like
MarketplaceService.ProcessReceipt = function(receiptInfo: { [string]: any })
return GamePassService:ProcessReceipt(receiptInfo)
end
I’m just using type annotations – since the receipt info is just a dictionary with string keys with arbitrary values of different types. I am just being explicit about it
That is setting ProcessReceipt to the function itself, when you do a = b() you aren’t setting a to the function b itself you are setting it to what it returns.
local function b() return 1 end
local a = b()
print(a) -- 1
local c = b
print(c) -- function: XXX