Error payable function of my smart contract

Hi everyone, I’m trying to call the payable function of my smart contract, but getting an error. I added the contract to Rinkebi. The function accepts ETH and sends tokens to the user. If I call the method this way (MyContract.methods.buyToken (). Call …) the function returns true but there is no transaction in the blockchain. In another case, when I call (MyContract.methods.buyToken (). Send …) I get an error. I would be grateful for any help.
p.s. Sorry for English (google translator)

I use web3, I write in js
code
var web3 = new Web3(new Web3.providers.HttpProvider(‘https://rinkeby.infura.io/v3/163677d447d44d4793f8b77f74c24605’));
var MyContract = new web3.eth.Contract(NFT_ABI, “0x261Bd75906F0299f30477fB9745C8B7997e3E222”);
MyContract.methods.buyToken().call({
from: “0x03C688d1583C19E6bd8110002442208E14d5e571”,
gas: 470000,
value:572000000000000,
gasPrice:1
}).then(console.log);

Hi @Vadim_Kupchinsky, we do not support the eth_sendTransaction method as it requires private key management which is not something we manage in order to provide the best security for our users. You can find a similar question here where EG provides helpful direction for how to sign your transaction and then send to us using eth_sendRawTransaction, eth_sendRawTransaction

1 Like