I have developed a website. Users need to prepay for his projects/tasks. Now I want to provide a way which a user can recharge his financial account on my website. Suppose the financial account of my website is a moneybookers account and a user can send money to this account manually, how could I develop the开发者_StackOverflow社区 interface? You know,many users will send money to the public account of the website, how can I determine the source where a sum of money come from? How can I make sure I won't add his account balance twice for only one money-transfer? If my question is not clear, please don't hesitate to ask for clarification.
Suppose you have an account on my website, it is yourname@example.com. And when you create the account, the balance is $0. Now you need to deposit money in yourname@example.com. You can do it manually. You just pay me $200, and notice that you have sent me $200, so I will update your balance to $200.
I don't use their API. If I use their API, this process is done automatically by computer program. I mean I want to do it manually, by hand.
I am sure that whatever moneybookers/paypal/neteller/whatever API you use, this is a problem for the financial institution, not you, as long as you stick to using their API and don't try to re-invent the wheel.
to my understanding, you have a site that accepts money proccessed via a payment gateway. The gateway sends a notification to a specified url at the end of a transaction with the transaction results. You then take these results and update your system with a new balance. Your fear is that a client can manually call the specified url that notifies your system twice.
If this is the case, here is my suggestion:
Your payment gateway should already stop someone from manually calling notification urls by implimenting consistant keys which are made using the transaction data your account details with them and a private key. Secondly you should manage you database by updating and storing your own transaction status's.
For instance, you have a transactions table with a uniqueid field as a primary key, amount, date/time, foriegn key linking to a users table and a foriegn key linking to a status table. Your status table will comprise of "inProgress", "Cancelled" and "Complete".
As soon as you send the transaction through to the payment gateway, create the transaction in your Transactionns table with a status of "inProgress". When you get the notification return to update your system run this logic:
if(returnedStatus == "Completed" && status = "inProgress")
(
status = "Completed";
//update balance
)
elseif(returnedStatus == "Cancelled" && status != "Completed"))
{
status = "Cancelled";
//display cancelled message
}
This will update the account balance if the transaction is still in progress, not update a the account if it is already done and do nothing to the account balance if it was cancelled for some reason.
PS: have a looke at monsterpay as a gateway www.monsterpay.com
精彩评论