Query about "payable" methods

Hi,

I have a question about “payable” methods.
I’m wondering if that is even possible. The use case is this :-
Customers place a bet on the smart contract paying for example 10 Matic for making the bet (the smart contract will run on polygon blockchain) - We will like to pay the gas fee for the user, so he only should pay the 10 Matic he bets, and we will pay for the gas fees The smart contract method is this one:

function bid(uint256 _raceId, uint256 _horseId) public payable 
{ require(msg.value == price, "Price is not correct"); // do stuff }

Is this possible?

Hey, this is a limitation of the meta-transaction framework. Native meta-txn do not support value transfers because the relayer will always send msg.value = 0

Workaround:

Instead of making it a native value transfer, you can take the amount in ERC20 tokens; essentially replace the native token transfer with an ERC20 token transfer
IERC20[token_address].transferFrom(_msgSender().address).address(this).value