I would like to accept Ethereum on my website but can not find information how to do this. I already accept Bitcoin. With Bitcoin it is quite easy to link unique Bitcoin address with the order number. When I see the incoming transaction I know the order number customer trying to pay.
But the difference between Bitcoin and Ethereum that it is not recommended to use new account for each new transaction. Am I right?
If I have one account for all incoming payments how I can know what order customer is paying? There is no payment memo or other information coming with the transfer.
Could anyone write a short algorithm or give some ideas?
I already have VPS (Ubintu), geth running with HTTP JSON-RPC support.
Best Answer
Here's a really simplistic contract to give you some ideas. I would suggest playing with it in Browser Solidity.
It records an order using orderNumber to identify them. orderNumber is presumed to come from order processing outside of the contract... it's a reference you can use to see how much Eth was sent and from whom.
The withdraw function let's the contract owner withdraw funds.
Since you're new, I'll point out that you must send Eth to the payable recordOrder() function, but you must not send Eth to the other non-payable functions. You'll probably find yourself missing that step and getting "Invalid Jump" errors. Order numbers are in hex format, e.g. "0x1". You'll do those conversions on the javascript side.
Hastily contrived example matching payments to order numbers. No warranty. :-)
Hope it helps.
Or, blindly accept payments and just keep track of who sent Eth.