Alright so I was scrolling through the wiki trying to find how I should most efficiently detect developer product purchases and then reward the player who purchased it accordingly, the issue I have here is that the wiki kind of contradicts itself,
So within both of these, they direct back to each other, where the PromptProduct event is deprecated but says its the only when to tell when a prompt is finished, so you’re supposed to use PromptPurchaseFinished, however that event says that you’re supposed to use PromptProduct, so I’m not really sure which one I should use?
You should be using MarketplaceService.ProcessReceipt to handle developer product purchases on the server. If you want to prompt the purchase on the client though then you’d call MarketplaceService.PromptProductPurchase.
You can find more information regarding developer products here.
@ClientScriptsThis is the script that I use to detect DevProduct purchases. I pretty much got it from the Developer Wiki but tweaked it to suit my needs.
PromptProductPurchaseFinished is only deprecated to discourage developers from wrongly using it to award purchases. It is still as valid a function as PromptPurchaseFinished and the intent of its removal is strongly dubious. Note that it says on its page that it is the only way to detect when a prompt closes.
When working with developer products, you are required to use ProcessReceipt. When a developer product purchase finished, ProcessReceipt will be invoked with information about the purchase (as specified on its documentation page). You can then use this information as well as your own code to determine whether a purchase should be validated and award items or not.
When you return PurchaseGranted to ProcessReceipt, the transaction is marked as successful and it’s the expectation that you the developer have honoured the purchase and given the user their respective items. If it is marked as NotProcessedYet, there is a 3 day window where ProcessReceipt will continually be invoked for the player (two known cases being when they join or make a purchase) until PurchaseGranted is returned. If not, the player is refunded for a failed transaction.
If you are making an interface that relies on when the prompt closes such as changing the colour of a button based on the purchase decision (confirmed or cancelled), you need to use PromptProductPurchaseFinished. This will be fired when the player either confirms the purchase or cancels it. You can then use the parameters to configure your Gui’s after-prompt effects, such as showing if a purchase succeeded or was cancelled or whatever.
Regarding the difference between the two: PromptProductPurchaseFinished is the event that fires when a purchase prompt for a developer product closes. PromptPurchaseFinished fires for any closed purchase prompts that are not for a game pass or developer product.