The PayPal plus checkout for brazil is not working with the PayPal plugin version 5.0.3

Hi

The PayPal plus checkout for brazil is not working with the PayPal plugin version 5.0.3

I am getting the following error

ppplusdcc.min.js:32 Uncaught TypeError: Cannot read properties of undefined (reading ‚substr‘)
at Function.Q [as doCheckout] (ppplusdcc.min.js:32:18474)
at e.value (all.js?1651217797837242:7:22729)
at XMLHttpRequest. (all.js?1651217797837242:3:46608)

I have just edited the plugin based on this documentation

Integrate Payment Selection Page

But not working

Can you please help?

Edited files

SwagPayPal/src/Resources/views/storefront/page/checkout/confirm/index.html.twig
SwagPayPal/src/Resources/app/storefront/src/checkout/swag-paypal.plus-payment-wall.js

   createPaymentWall() {
        this.paypal = window.PAYPAL;

        this.paypal.apps.PPP({
            placeholder: this.options.placeholder,
            approvalUrl: this.options.approvalUrl,
            mode: this.options.mode,
            country: this.options.customerCountryIso,
            buttonLocation: this.options.buttonLocation,
            language: this.options.customerSelectedLanguage,
            useraction: this.options.userAction,
            surcharging: this.options.surcharging,
            //showLoadingIndicator: this.options.showLoadingIndicator,
            //showPuiOnSandbox: this.options.showPuiOnSandbox,
            onLoad: this.onPaymentSelectionLoad,

            /* ------Brasil PoC Extension------ */

            payerEmail: this.options.payerEmail,
            payerFirstName: this.options.payerFirstName,
            payerLastName: this.options.payerLastName,
            payerPhone: this.options.payerPhone,
            payerTaxId: this.options.payerTaxId,

            /*  -------------------------------- */
        });
    {% if page.extensions[constant('Swag\\PayPal\\Checkout\\Plus\\PlusSubscriber::PAYPAL_PLUS_DATA_EXTENSION_ID')] %}
        <!--script src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js"></script-->

        <script src="https://www.paypalobjects.com/webstatic/ppplusdcc/ppplusdcc.min.js" type="text/javascript">
        </script>
    {% endif %}

Is it possible that it has to do with the fact that Paypal-Brazil requires the Brazilian federal states to be entered in the address?
Please check whether the state selection is active and configured as a mandatory field for Brazil.

Hi @drakon

I have added state, but no hope, same error.

Store the config object in a variable like below.

this.ppp = this.paypal.apps.PPP({
            placeholder: this.options.placeholder,
            approvalUrl: this.options.approvalUrl,
            mode: this.options.mode,
            country: this.options.customerCountryIso,
            buttonLocation: this.options.buttonLocation,
            language: this.options.customerSelectedLanguage,
            useraction: this.options.userAction,
            surcharging: this.options.surcharging,
            //showLoadingIndicator: this.options.showLoadingIndicator,
            //showPuiOnSandbox: this.options.showPuiOnSandbox,
            onLoad: this.onPaymentSelectionLoad,

            /* ------Brasil PoC Extension------ */

            payerEmail: this.options.payerEmail,
            payerFirstName: this.options.payerFirstName,
            payerLastName: this.options.payerLastName,
            payerPhone: this.options.payerPhone,
            payerTaxId: this.options.payerTaxId,

            /*  -------------------------------- */
        });

then you can use

this.ppp.doContinue();