I would like to use a <script> in my Angular component, how do I do that?

185 Views Asked by At

I need a MercadoPago payment checkout in Angular 11.

I am having trouble implementing the in my child component.

Here is the documentation: https://www.mercadopago.com.br/developers/en/guides/online-payments/checkout-pro/integration#editor_5

When applying the documentation to my code, the payment button does not render.

<script>
    const mp = new MercadoPago('PUBLIC_KEY', {
        locale: 'es-AR'
    });
    mp.checkout({
        preference: { id: 'YOUR_PREFERENCE_ID' },
        render: {
            container: '.cho-container',
            label: 'Pay',
        }
    });
</script>

This error appears on my console:

Error in console

0

There are 0 best solutions below