customer fund management system design in shopping websites

A newbie website programmer may thinks it easy to handle the customer’s fund. Consider a buyer buys a goods/service from a seller on your website. Most likely he will handle the fund of the buyer and seller as follows:

$buyer->money-=$price;
$seller->money+=$price;

This is very risky. The seller may withdraw his money immediately, leaving no time for the buyer to cancel his order. If the goods is a kind of service that lasts for some time, the above code will form a prepaid. In most cases, it is proved that postpaid is more safe and more comfortable for both buyer and seller. But you should not do the above code at the end of the service term, which would be unfair to the seller. The correct way to deal with the transfer of fund is using another variable to freeze some money of the buyer at the buying time.

$buyer->money-=$price;
$buyer->frozenmoney+=$price;

Now the buyer cannot withdraw or use the frozen part of his money to buy other goods. But the seller is not getting the money at the moment. When the time comes near the end of the service term, the system should update the money of the buyer and seller as follows:

$buyer->frozenmoney-=$price;
$seller->money+=$price;

The update can be done automatically using a cron job.

 

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:
Posted in

Comments are closed, but trackbacks and pingbacks are open.