3

I am working on receiving ether on existing ecommerce site. For whatever reason, a decision has been made to run Ethereum node locally and not use any existing payment gateways.

I am relatively new to Ethereum. Based on what I read across forums, I can think of 2 possible approaches:

Approach 1: For each eCommerce transaction on website, create a new contract and hand over its address to the customer to make payment to. Periodically check balance on the contract address, if balance is > 0 - this implies that payment has been made. Send payment from contract address to another main account address to consolidate payments.

Approach 2: For each eCommerce transaction on website, create an account private key + address and hand over its address to the customer to make payment to. Periodically check balance on the above address, if balance is > 0 - this implies that payment has been made. Send payment from contract address to another main account address to consolidate payments.

I am wondering if approach 2 is even worth considering. I am looking for some expert guidance here on how best to do it, given the restriction that local Ethereum node is to be used.

Thanks for your help.

2

What requirements do you have, apart from just being able to receive ether? If there are none, you only need an address. Run the node, give customers the address, let them pay. Does not differ much from accepting Bitcoin. If you want to track payments (e.g., differentiate between new and returning customers), you can do that off-chain (either using some wallet feature or parsing the blockchain with a common programming language like Python).

You only need a smart contract if you want to implement more complex logic, for instance, automatically rewarding customers with tokens, etc.

  • Thanks for your reply. I want to find out which customer made the payment and the amount paid by the customer. If everyone is paying to the same customer - how will I be able to differentiate? Can you please point to some examples of tracking payment off-chain that you have mentioned? Will I be able to find out the customer who has made the payment? – Kevin Aug 4 '17 at 12:30
  • @Kevin by looking at the "from" and "value" fields on the blockchain (example: random address at etherscan explorer). That of course does not work if the customer uses another address next time -- but in that case a smart contract won't help either. In Ethereum world the Bitcoin-style "fresh address for every tx" practice is not so common, as smart contracts use addresses for authentication. – Sergei Tikhomirov Aug 4 '17 at 12:34
  • Thanks again for your quick reply. However, I cannot think of a way to link my customer with the "from" address. Is there a way to know? The only way I could think of it by giving each customer a unique contract address - same as bitcoin approach. – Kevin Aug 4 '17 at 12:39
  • @Kevin The simplest approach that comes to mind is to make it beneficial for the customer, e.g., "get 5% off on your second order (use same address so that we can recognize you)". Or users can register and log in, so that you show the address corresponding to the internal user ID in your system. – Sergei Tikhomirov Aug 4 '17 at 13:00
  • I still do not see how can I link the first payment with the customer, I need to know which customer in my system has made payment - so that the particular order can be shipped. – Kevin Aug 4 '17 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.