I haven't worked with MasterCard, but recently i've done this with RedSys and I wasn't using an embedded HTML but a PHP form on my server. I recommend you to go this way.