Idea

Martin L avatar image
Martin L suggested

Extra API call that both purchases an item AND runs a cloudscript

I would like to be able to set custom data when I purchase an item. Currently the only way to do this is to ignore the built in Purchase item API and use a cloud script that contains a Grant Item and Subtract Currency pair, and then set my custom data. It would be great to have an API call that purchased the item and then executed a given cloud script, with the purchased item instance id as an argument to the script.

apis
2 comments
10 |1200

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

mgambrell avatar image mgambrell commented ·

For reference, here's discussion of the annoying workaround for not having this functionality (make sure you leave the data in a state where it can be finished next time the user logs in, in case he bails in the middle of the purchase) : https://community.playfab.com/questions/521/207389858-Purchase-from-server.html

(3rd time I've posted this, in case anyone wonders what it means when the other 2 posts appear)

0 Likes 0 ·
brendan avatar image brendan mgambrell commented ·

The lower section ("Post a comment") on an Idea works the same as posting an Answer on a Question in the other forums. Due to issues dealing with spammers, we had to make the settings for AnswerHub put new posts in those categories into a moderation queue for any user with 0 reputation. I've taken care of the other two posts, to prevent confusion.

0 Likes 0 ·

1 Comment

·
brendan avatar image
brendan commented

To do this, you would use a PlayStream Rule (action trigger) that fires on the player_inventory_item_added, running a Cloud Script that adds the custom data you need (using the information on the item which is available in the context passed into the Cloud Script handler).

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 a Comment

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

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.