• Attaches a custom component to the specified CardFormEmbedOptions.target and opens the Paytool Client Card Form in an iframe.

    The component handles the iframe's responsiveness internally, starting with height set to 0, waiting for the iframe's DOM tree to render.

    Returns a Promise that resolves with an instance of CardFormEmbed once the iframe's height is determined.

    For additional options, styling, and event listeners, see CardFormEmbed.

    Parameters

    Returns Promise<CardFormEmbed>

    Example

    const form = await Paytool.embedCardForm({
    target: document.getElementById('card-form')!,
    paymentMethods, // strongly recommended; enables CardNumberInfo events
    optionalElements: true,
    onFormStateChange: s => console.log('valid?', s.isValid),
    onCardNumberChange: e => console.log(e)
    });