Metamask Ethereum payment method module for Magento 2
Extension allows to receive direct payments from customer Ethereum blockchain wallet to merchant Ethereum wallet using Metamask in Ethereum cryptocurrency Ethers.
Using any gateways and third party services to make and receive payments breaks the philosophy of cryptocurrencies. If you use cryptocurrencies to pay you should be able to make it directly between wallets that no one can control, interrupt and change your transaction. But when this module was created there are only modules for Magento 2 from companies that are gateways between customer and merchant and handle the payment process, can control this process and payment processes in this case have no any differences from using bank account.
The main idea of this module is to allow you make and receive payments directly between wallets, without using any third party gateways and commission and pay only networks gas.
- Display prices in Ether currency
- Pay by Ether from checkout after placing order
- Pay from customer accound order view page (customer can pay on checkout or, if have any troubles, later from his account)
- Check transaction status using
web3js
library - Check transaction status through
etherscan.io
API request - Check transactions by cron using
etherscan.io
API request - Check transaction manually from admin area transaction page
To install module you need to add repositories to your composer.json
:
"repositories": {
"crypto-base": {
"type": "git",
"url": "git@github.com:torys877/crypto-base.git"
},
"crypto-currency-precision": {
"type": "git",
"url": "git@github.com:torys877/crypto-currency-precision.git"
},
"crypto-metamask-eth-payment": {
"type": "git",
"url": "git@github.com:torys877/crypto-metamask-eth-payment.git"
}
}
Or add repositories from console:
composer config repositories.crypto-base git git@github.com:torys877/crypto-base.git
composer config repositories.crypto-currency-precision git git@github.com:torys877/crypto-currency-precision.git
composer config repositories.crypto-metamask-eth-payment git git@github.com:torys877/crypto-metamask-eth-payment.git
Install module:
composer require cryptom2/metamask-eth-payment:v1.0.0
And run
php bin/magento setup:upgrade
- Enabled - enable/disable payment method
- Title - payment method title
- Ether Network Version - version of network (can be checked in metamask settings, by default Ethereus is
1
, but testing networks have another version) - Merchant Ether Address - merchant ethereum address to take payment
- Etherscan Url - url to view transactions (can be different in different networks, useful during testing)
- Check transaction on Etherscan - if set not cron does not work and transactions are checking only on frontend on payment page using web3js
- Etherscan Api Url - display if
Check transaction on Etherscan
is enabled. Api url for needed network to check transaction (can be different for different networks) - Etherscan Api Key - display if
Check transaction on Etherscan
is enabled. Api key for etherscan - can be taken on etherscan.io/apis
Settings are the same as for Live
, but you need to use test networks (test network version, test network etherscan api url/key etc. On screen uses Ropsten
network)
To display ETH currency you also need to add it to allowed currencies
and add currency rate in magento (automatically update rates will maybe included in future releases)
Note: Payment method is displaying only if ETH currency selected
Note: If wallet is not connected firstly customer sees 'Connect Wallet' button, then 'Pay' button
Note: After confirming transaction in Metamask wallet, customer should wait on the same page to magento confirm transaction
Magento sends request to metamask using Web3js and try to get confirmation message, after it, Magento
sends request to server and if Etherscan checking is enabled, transaction status also is checking on etherscan.
IMPORTANT: it is highly recommended to enable etherscan checking to prevent JS injection on processing page
Transaction ID is clickable and move you on etherscan page for this transaction
If customer placed order but not paid it, he still can do it from his account. This button sends him to processing page and allows to do payment
When transaction is captured and approved in blockchain and magento, customer sees this message
Metamask Ethereum extension for Magento 2 is licensed under the MIT License - see the LICENSE file for details