Forum PayVault Can I get to a Player's vault from PlayerObject?

Discussion and help relating to the PlayerIO payment solution, PayVault.

Can I get to a Player's vault from PlayerObject?

Postby moosemouse » May 12th, 2011, 11:15 pm

I have a racing game with an asynchronous challenge feature. So a player can race against the clock, then challenge another player to beat his time. They can also wager virtual money.

When a player (the Challengee) accepts and loses an asynchronous challenge, I would like to add the wager money into the original race creator's (the Challenger's) PayVault. Most likely the Challenger is offline. How can I credit his PayVault when he is offline? Or do I have to save something in the Challenger's PlayerObject, and credit him the next time he is online? I would prefer to do it immediately, from the Challengee's message, if possible.

Thanks,
Shawn
User avatar
moosemouse
Paid Member
 
Posts: 83
Joined: August 11th, 2010, 2:51 pm
Location: New Albany, Ohio USA

Re: Can I get to a Player's vault from PlayerObject?

Postby Benjaminsen » May 12th, 2011, 11:29 pm

The only real way to solve this securely is to use either the Multiplayer Server or your own web service to load both users and credit / debit them using the secure backend.

Or said in another way, you should not do this from the client.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Can I get to a Player's vault from PlayerObject?

Postby moosemouse » May 13th, 2011, 12:00 am

I know this sounds really stupid, but I am doing it from the Multiplayer Server side, and I can't figure it out. How do I load a player who is not connected?

I have the Challenger's Id so I can get his PlayerObject, but I don't know how to get from there to player.PayVault.. I am sure I'm missing something really obvious.
User avatar
moosemouse
Paid Member
 
Posts: 83
Joined: August 11th, 2010, 2:51 pm
Location: New Albany, Ohio USA

Re: Can I get to a Player's vault from PlayerObject?

Postby Henrik » May 13th, 2011, 9:00 am

Oh, asynchronous. Hm, no, you can't get the Player object of a disconnected player in the server, and therefore you can't access his Vault either.

I guess the best option for now is to queue "actions" in BigDB and execute them when the player connects again, but being able to load the Player object of a disconnected player would be kinda useful, I can see that.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Can I get to a Player's vault from PlayerObject?

Postby Benjaminsen » May 13th, 2011, 9:43 am

Henrik wrote:Oh, asynchronous. Hm, no, you can't get the Player object of a disconnected player in the server, and therefore you can't access his Vault either.

I guess the best option for now is to queue "actions" in BigDB and execute them when the player connects again, but being able to load the Player object of a disconnected player would be kinda useful, I can see that.


As Henrik points out, apparently it's not currently possible. I will make sure to bring it up internally and find a solution as it's clearly a missing component of PayVault.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Can I get to a Player's vault from PlayerObject?

Postby freerangegames » October 15th, 2014, 2:03 pm

bump!
Any news or found workarounds on this? I'm writing an admin tool that should manage player's items, but if I can't access player's payvault I'll need to re-implement the payvault through database. That would suck.

Kova
freerangegames
 
Posts: 6
Joined: August 6th, 2013, 2:01 am

Re: Can I get to a Player's vault from PlayerObject?

Postby Henrik » October 15th, 2014, 4:51 pm

Hey Kova,

The feature request is on our todo-list, so it might get done in the future.

For now, I would still go with some sort of BigDB-based queue of operations to do once the user connects to a service room.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Can I get to a Player's vault from PlayerObject?

Postby whitershores » August 3rd, 2015, 11:15 pm

Any updates on this feature?
whitershores
Paid Member
 
Posts: 88
Joined: June 21st, 2011, 4:19 pm

Re: Can I get to a Player's vault from PlayerObject?

Postby Henrik » August 4th, 2015, 12:13 am

Yes, but I can see that our Multiplayer documentation wasn't updated with examples on this. You can now do something like:

Code: Select all
var vault = PlayerIO.GetUserPayVault("connectUserId");
vault.Refresh(delegate() {
    vault.Credit(100, "Won a bet", null, null);
});
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to PayVault



cron