That’s correct. The flow is
- You set the ProcessReceipt function
- Player makes a purchase
- Roblox calls your ProcessReceipt function with the details of the purchase
- Your ProcessReceipt function handles the purchase, like saving their purchase to datastore, changing their walkspeed, etc.
- Your ProcessReceipt function returns PurchaseGranted so that Roblox knows you are done handling the purchase
- If for some reason you couldn’t handle the purchase (e.g. the player is not in the server so they have no humanoid to change walkspeed), then you need to return NotProcessedYet.
- If you returned NotProcessedYet, the ProcessReceipt function will be called again in the future to try again. The times it is called again I believe are if they make another purchase or join a server.
That’s correct. The flow is
- You set the ProcessReceipt function
- Player makes a purchase
- Roblox calls your ProcessReceipt function with the details of the purchase
- Your ProcessReceipt function handles the purchase, like saving their purchase to datastore, changing their walkspeed, etc.
- Your ProcessReceipt function returns PurchaseGranted so that Roblox knows you are done handling the purchase
- If for some reason you couldn’t handle the purchase (e.g. the player is not in the server so they have no humanoid to change walkspeed), then you need to return NotProcessedYet.
- If you returned NotProcessedYet, the ProcessReceipt function will be called again in the future to try again. The times it is called again I believe are if they make another purchase or join a server.
The biggest problematic cases you have to be aware of are
- ProcessReceipt can be called more than once for the same purchase, so you need to ensure you don’t grant a second time if the first handler is still ongoing. An in-memory table of purchases being processed solves this.
- ProcessReceipt can be called for the same purchase in multiple servers if the player joins another server while the previous server is still processing the purchase. This is where session locking the player data is important, so the new server avoids processing it if the previous server is still holding a lock on their data.