Generate address for ethereum payment gateway

Viewed 1450

I want to add 'pay with ethereum' feature to my website and i know in ethereum we have a HD wallet which gives us some account, but i don't know for something like payment should i generate new account each time for a new invoice? and then transfer ether into main account? is smart contract involve in this solution or not.

I'm using dotnet core (c#) , ganache as test-chain and nethereum.

2 Answers

There are three ways to create a payment gateway on Ethereum

  1. HD wallet as you described - not different approach from Bitcoin days

  2. A single forwarded smart contract that separates the customers by their reference number in a Data field of the transaction. Note that the data field is automatically filled by MetaMask and such wallets, so the users will never see this. Note that if people are not using a proper wallet like MetaMask or Trust mobile, but try to make a payment from centralised exchange, this approach would reject their payments.

Example: https://github.com/TokenMarketNet/smart-contracts/blob/master/contracts/PaymentForwarder.sol

  1. A master smart contract that deploys a new payment forwarder smart contract to each customer address making a payment. In this case, addresses are made deterministic by CREATE2 EVM opcode. Coinbase uses this approach as it makes the payment processing non-custodial and Conbase itself cannot steal the money from merchants. Any fees can be baked in the smart contract.

https://blog.coinbase.com/usdc-payment-processing-in-coinbase-commerce-b1af1c82fb0

You don't need new account per invoice, you just need to maintain one account. There are two ways to do this according to me:

  1. You can make your smart contract or use some open source token transfer contract to allow transfer of token from the sender to your account.
  2. You can use some existing crypto currency based payment gateway like b2binpay https://b2binpay.com/

Let me know if this was helpful.

Related