Include player-paid price in item purchase events

Background

In some games, such as Plz Donate, products are displayed to players with their listing price. To reduce the number of requests made to the Roblox API, caching the details of this product is the best solution. When a player purchases the product, they will pay whatever the item is worth when they receive the prompt as long as the price is the same. There is no issue with this up until the point of displaying this to players.

Problem

If the server caches the price, a player-owned item can be repriced. The server would see the prompt as a 1,000,000 R$ purchase when in reality the player only paid 10 R$. The server would need to make a second request for updated details, which at any time risks failing.

Solution/Request

Include the price the player actually paid for the item within the event. Instead of just giving the ID of the purchased product along with a receipt ID, provide the price of the item when they bought it.
This would allow PromptPurchaseFinished and PromptGamePassPurchaseFinished to provide developers with access to the amount spent similar to how product receipts include CurrencySpent.

9 Likes

Assuming you are talking about MarketplaceService.ProcessReceipt (I assume you are, as AFAIK it is the only time “receipt” is used in the documentation), this already exists. According to the documentation:

The receiptInfo table passed to this callback will contain the following data:

  • PurchaseId — A unique identifier for the specific purchase.

  • PlayerId — The user ID of the player who made the purchase.

  • ProductId — The ID of the purchased product.

  • PlaceIdWherePurchased — The place ID in which the purchase was made; not necessarily the same as the current place’s ID.

  • CurrencySpent — The amount of currency spent in the transaction.

  • CurrencyType — The type of currency spent in the purchase; always CurrencyType.Robux.

CurrencySpent is what you want.

2 Likes

It was poor of me to refer to it as a receipt. I meant for gamepasses, clothing items, etc. I will adjust my post to reflect that more accurately.

2 Likes

That makes more sense. What you want seems to be the same as this post.

2 Likes