Return PurchaseId with PromptProductPurchase

As a Roblox developer, it is currently too hard to give a user context-specific items when PromptProductPurchase is fired for context-specific reasons.

My specific use case is that players are able to buy in-game items with in-game tokens, but if their token funds don’t cover the item then the user is prompted to buy tokens with Robux, after which the bought tokens are automatically used to buy the item.

Currently, to achieve this, I have to guess that the first purchase made for a specific product is for this context-specific purpose. If PromptProductPurchase returned a PurchaseId, then I could mark down the purpose of the PurchaseId to make sure that the bought tokens are used for what they should be if the purchase succeeds.

If Roblox is able to address my issue, it would allow me to program safer context-specific product purchase prompts, where buying the product activates a context-specific action.

8 Likes

Use DataStores on ProcessReceipt

That doesn’t fix my problem. I’m already doing that.

I don’t know if the ProcessReceipt is for the context-specific purchase.

The player…

  • might be buying tokens through the automatically-buy-items system
  • might have separately went to the tokens shop and bought tokens
  • might be using the automatically-buy-items system with a completely different item.

I need to know what caused the purchase during ProcessReceipt, not after. I need to know what item, if any, caused the token sale so that, in the ProcessReceipt, I can give the player the right amount of tokens and items, since that depends on what caused the sale.

One way to do that would be to match up a PurchaseId returned by PromptProductPurchase with the PurchaseId that ProcessReceipt gives, but I can’t do that because PromptProductPurchase doesn’t give me a PurchaseId.