Developers Forum for XinFin XDC Network

Ayyalusamy Ramadoss
Ayyalusamy Ramadoss

Posted on

Unable to call payable function from Remix, XDCPay and send funds

Hi, I am new to XDC. I have below payable function in my contact

function buyTokens(address beneficiary) public payable {
}

When I try to call from Remix, XDCPay amount shows 0 (zero) and not able to edit and send funds to buyTokens function.

What could be the reason? Can you help me

Discussion (2)

Collapse
ruslan_wing profile image
ruslan wing

Can you please share your contract or the buyTokens function code over here to understand more about your issue

Collapse
ayyalu profile image
Ayyalusamy Ramadoss Author

function buyTokens(address beneficiary) public payable {
uint256 tokens = msg.value * 10;
_token.transferFrom(_wallet, beneficiary, tokens);
emit TokensPurchased(_msgSender(), beneficiary, msg.value, tokens);
_forwardFunds();
}