I want to be able to change a value in user data if that user does not make any purchases last 7 days. Is there any way to handle this with the existing Playfab system?
I want to be able to change a value in user data if that user does not make any purchases last 7 days. Is there any way to handle this with the existing Playfab system?
I got it working by using the CloudScripts. This is my workaround.
- Created a Rule which is getting fired when there is a receipt validation event happens. If receipt validation is valid then the Rule runs a cloud script which updates player data with the date and the value that I want to set.
Thanks for your recommendation as well. Appreciated for your time.
It will have to be done manually in the code. You can go ahead with the following approach.
Get the Player Inventory Items and sort them based on PurchaseDate and then after sorting check the last item in the list(After sorting the last item will be the last purchased item). Using this last purchased item you can check if the user has made any purchases in last 7 days
Thanks for the answer. I tried your recommendation before, however when I try to get Player Inventory, I dont get anything back because all items are already expired. So, GetPlayerInventory is disregarding the expired items. By the way, my setup is when user does in-app purchase, I grant the user with and inventory item which has 5 second expiration time. Am I missing anything here?
So I believe everytime something is been added to inventory it will have a 5 seconds expiry time and later on there will be no item in inventory after expiry. As far as I know, playfab hasn't added a support for getting expired items yet.
So in this case the workaround I could think of is
- When the player does an in app purchase, an item is added to inventory. So store that Timestamp in their respective player data. Since all items have 5 seconds expiration time when a new item is purchased the old timestamp in player data should be replaced with the new timestamp and same can be accessed to check when was the last purchase made.
Will this work for you?
2 People are following this question.