I have a website where clients pay for a service but have to out the money upfront via escrow, I'm very proficient with PHP (this is what the website is coded in) how would I go about implementing an escrow system that would work automatically?
You need to break down your design into components and think about the process.
Escrow works like this:
- Entity A deposits money into Escrow Account for Entity B.
- Entity A and Entity B come to an agreement
- The Escrow account is deposited to Entity B.
Implementation wise, I'd track escrow deposits like any transaction, I'd also track escrow payments the same way.
You need to come up with a way to store "Work Orders" in a database. These would have two columns "AcceptedByA", and "AcceptedByB", as well as the amount of money.
The process would be:
- Entity A opens a workorder and pays $X into the Escrow Account
- Entity B does whatever the workorder requires (Setting AcceptedByB to true)
- Entity A sets "AcceptedByA" to true.
- A transaction runs to pay EntityB from the Escrow Account.
This is extremely high level, but its a rather simple idea.
IMHO the question is too generic. Are you looking for a PHP-MySQL level design? Like what tables etc? or are you looking for services that you can use?
For simplification, let's assume you are using Paypal to receive and pay money.
Buyer A needs to setup and escrow for Seller B.
- You charge A $x and save that amount in your Paypal account.
- You create a logical record that tells you that $x have been received and are for B.
You'll have to implement transactions (MySQL or layered in PHP) to make sure that both the above mentioned steps happen. If for some reason creating a logical record fails - re-try second step for n number of times and if it still fails, then fail (refund) the first step.
You'll have to adopt a similar approach when the user releases the escrow.