cryptom2 / metamask-eth-payment
Metamask & web3js Ethereum支付方式Magento 2模块,无需任何第三方网关
Requires
- cryptom2/base: >=1.0.1
- cryptom2/currency-precision: v1.0.0
This package is auto-updated.
Last update: 2024-09-10 23:34:35 UTC
README
为Magento 2提供的Metamask Ethereum支付方式模块
目录
描述
本扩展允许使用Metamask在Ethereum加密货币Ethers中,直接从客户Ethereum区块链钱包接收支付到商家Ethereum钱包。
想法
使用任何网关和第三方服务进行支付违背了加密货币的哲学。如果您使用加密货币进行支付,您应该能够在没有第三方控制、中断或更改您交易的情况下直接在钱包之间进行支付。但是当创建此模块时,只有来自公司之间的模块,它们是客户和商家之间的网关,并处理支付过程,可以控制此过程,在这种情况下,支付过程与使用银行账户没有区别。
此模块的主要思想是允许您在钱包之间直接进行支付和接收支付,无需使用任何第三方网关和佣金,只需支付网络气费。
功能
- 以Ethereum货币显示价格
- 在下单后通过结账支付Ethereum
- 从客户账户订单查看页面支付(客户可以在结账时支付,如果有任何问题,可以从他的账户稍后支付)
- 使用
web3js
库检查交易状态 - 通过
etherscan.io
API请求检查交易状态 - 使用
etherscan.io
API请求通过cron检查交易 - 从管理员区域交易页面手动检查交易
安装
要安装模块,您需要将存储库添加到您的composer.json
Composer安装
"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"
}
}
或从控制台添加存储库
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
安装模块
composer require cryptom2/metamask-eth-payment:v1.0.0
然后运行
php bin/magento setup:upgrade
设置
实时设置
- 启用/禁用 - 启用/禁用支付方式
- 标题 - 支付方式标题
- Ether网络版本 - 网络版本(可以在Metamask设置中检查,默认情况下Ethereum是
1
,但测试网络有另一个版本) - 商家Ethereum地址 - 接收支付的商家Ethereum地址
- Etherscan URL - 查看交易的URL(在不同网络中可能不同,在测试期间很有用)
- 在Etherscan上检查交易 - 如果设置,cron不会工作,并且仅在支付页面的前端使用web3js检查交易
- Etherscan API URL - 如果启用“在Etherscan上检查交易”,则显示。检查所需网络的交易API URL(对于不同网络可能不同)
- Etherscan API密钥 - 如果启用“在Etherscan上检查交易”,则显示。Etherscan API密钥 - 可以在etherscan.io/apis上获取
测试模式
设置与实时
相同,但您需要使用测试网络(测试网络版本、测试网络Etherscan API URL/密钥等。屏幕上使用Ropsten
网络)
显示Eth货币
要显示ETH货币,您还需要将其添加到允许的货币
中,并在magento中添加货币汇率(自动更新汇率可能在未来的版本中包含)
屏幕截图
显示价格
结账时的支付方式
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
使用ETH支付
处理交易
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
作者
伊戈尔·奥列ksiienko
许可证
Metamask Ethereum扩展程序适用于Magento 2,采用MIT许可证——有关详细信息,请参阅LICENSE文件