How to add amount in wallet after match win and deduct on match join

How to deduct amount from wallet at the time of match join according to joined table price and add amount into wallet of winner user after the win of match.

@kmsudhir Have a look at the wallet API. You can call it in match join to deduct the entry fee for the player and store the value deducted in the match state for that user (in case you need to refund it for some reason). Then at the end of the match handler loop where you calculate the win conditions and decide whether the match has ended you would use the same wallet API to grant the winnings to the player.

https://heroiclabs.com/docs/user-accounts/#virtual-wallet

Hope this helps.

1 Like