Create an Asynchronous edition of MarketplaceService.ProcessReceipt

As a developer, it is currently difficult to integrate multiple purchase handlers into a game - all purchase handling must be done from one function.

This is inconvenient in the following use-cases:

  • When another external codebase lays ontop of your system (i.e. you insert a model that can hook up to give admin to a player who buys a dev product live in game - this requires you to reroute if you already have a receipt processor set up)

  • When you run a non-authoritative server setup (this is common of a lot of developers) - some people don’t like centralization for things and want them to run independently for reusability & debugging.

Whilst I personally use a central marketplace handler, this is an unnecessary limitation of developers ability to process items and can lead to less experienced developers implementing insecure or poor workarounds to having different-from-the-ideal codebase setups.

3 Likes

To the best of my knowledge ProcessReceipt is a callback because the return value from it matters. It’s not possible for it to be a signal as a result since the return value from connections is discarded.

Yeah - I was thinking the same thing too.

I’m sure a solution for it could be devised, i.e. turning it asynchronous ( MarketplaceService:MarkPurchaseFinished(key) perhaps, for example)

1 Like

Another option would be to add something like a :AddPurchaseCallback(productId, callback) function.

Would essentially work like the current callback, but it’d only get invoked for one particular product.

Should make it easier to handle multiple purchases and solve the issues mentioned above?

8 Likes

Potentially you can use Promises to do this.

I do, however, agree that a signal for this would be useful.

1 Like

Yeah, my current system routes all the stuff fine, but I’m looking for a vanilla solution - this is less for me and more for developers who might not understand how these things work. A Developer I worked with yesterday accidentally overwrote our receipt processor and it destroyed our revenue.

1 Like