We WONT give code. But we WILL help you code it.
Questions:
1) How far have you got in coding it yet?
2) Do you know the Facebook API?
if the answer to either is no, then please state what you want to know how to do, and we will try out best to help you.
Answer:
You want to be able to lower money from them if they buy something,
Now assuming your storing the prices and money etc. in database (you should do this), This is quite a simple task.
I will assume two tables are used.
Table 1:
name: items
fields:
id (int(11) AI PK)
name (varchar(255)
price (float(6,2))
Table 2:
name: users
fields:
id (int(11) AI PK)
name (varchar(255)
credit(float(6,2)
pass (varchar(32))
then from there, you will select an items cost via its id from the items table
eg:
$query1 = mysql_query("SELECT price FROM items WHERE id=1");
$result = mysql_result($query1,0);
from there, you need to take that price away from the users credit:
eg:
$query2 = mysql_query("INSERT INTO users SET credit=(credit-$result)");
That should work.