How to check if player is declined developer products?

Hello. I just want to check the player are declining developer products when they click Cancel.
The issue is I can’t check that player just declined developer products.

When player clicks Buy now,
MarketplaceService:PromptProductPurchase runs and
MarketplaceService.ProcessReceipt starts, returns Enum.ProductPurchaseDecision.PurchaseGranted and I can know they just purchased developer products.

But there is no ways to check that knows they just declined developer products.
I was thinking that I can use wait() to wait for player, but I don’t know how long do I have to wait.

Please tell me the ways of getting check of declining, or great ways if it’s not about telling about declining.
Thanks in advance!

1 Like

This is possible, yes.
Check this wiki page:

wasPurchased: Whether the item was successfully purchased (false for errors and cancellations)

local MarketplaceService = game:GetService("MarketplaceService")
 
local function gamepassPurchaseFinished(player, gamePassId, wasPurchased)
    if wasPurchased == true then
        -- code    
    else
        -- declined code
    end
end
 
MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)

Thank you for answering to my questions.
I made a some script to check if it is declined:

local MarketplaceService = game:GetService("MarketplaceService")

local Products = -- Secret for this one, and this one is working.

function DeveloperProductsRecieptCompleted(Player, ProductId, wasPurchased)
	if wasPurchased == true then
		print("Yep.")
	else
		print("Nope.")
	end
end

MarketplaceService.ProcessReceipt = function(Reciept)
	local Player = game:GetService("Players"):GetPlayerByUserId(Reciept.PlayerId)
	if Reciept.ProductId == Products then
		warn("Purchased")
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

MarketplaceService.PromptGamePassPurchaseFinished:Connect(DeveloperProductsRecieptCompleted)

So this one. I just tested it for few times, but they doesn’t show me a result.
Do I have a error on this?

PromptGamePassPurchaseFinished is only for gamepasses;
You’re probably looking for PromptProductPurchaseFinished