question

eric@begoodi.fr avatar image
eric@begoodi.fr asked

Purchase from server

What is the process if a client buys an item and if I need to do additional stuff (validation controls and/or other post processing updates) ?

The PurchaseItem API on only available from the client, so it does not seem possible to add some verification controls before buying.

The client could call a CloudScript that makes the job (controls, decrement VC, grant item, post-updates) but what happens if there is an error on the grant item step ? The VC will already have been decremented ; i.e. it's not part of a whole transaction isn't it ?

I think I missed something somewhere for this basic task...

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

The idea of using Cloud Script is correct, but the way to do this is not bypassing the purchase operation (in particular, that would mean that the purchases aren't tracked as actual purchases), but rather to make the Cloud Script call a post-purchase operation. So, you would have the client call the Cloud Script to complete the configuration of the item once it has been purchased. It would be important (for scenarios where the player loses connection right after the purchase) to also double-check that items have completed configuration on startup, so that you can call the configuration Cloud Script again for any items that haven't been finished as yet.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.