• I’m implementing the fast checkout button in my payment plugin.
    I want the button to call a gateway function in order to proceed with the verification. Unfortunately I’m stuck, can anyone give me some advice?

    this is my code:

    // Definisci la funzione che gestisce il processo di pagamento

    const ocess = async () => {

        console.log(‘Inizia il processo di pagamento’);

        // Implementa qui la logica di pagamento

      };

      // Crea il pulsante con l’evento onClick impostato correttamente

      const MyExpressCheckoutButton = window.wp.element.createElement(

        ‘button’,

        { onClick: ocess, type: ‘button’}, // Passa la funzione senza eseguirla

        ‘Paga Ora’

      );

      // Definisci il metodo di pagamento

      const myExpressPaymentMethod = {

        name: ‘my_express_payment_method’,

        content: MyExpressCheckoutButton,

        // Assicurati che il componente Content esista o modifica questa parte con un componente valido

        edit: Object( window.wp.element.createElement )( Content, null ),

        canMakePayment: () => true,

        ariaLabel: ‘paga ora’,

        supports: {

          features: [‘products’], // Assicurati che l’array di features sia definito correttamente

        },

        paymentMethodId: id,

      };

      // Registra il metodo di pagamento

      if (window.wc && window.wc.wcBlocksRegistry) {

        window.wc.wcBlocksRegistry.registerExpressPaymentMethod(myExpressPaymentMethod);

      } else {

        console.error(‘wcBlocksRegistry non è definito. Assicurati che WooCommerce Blocks sia installato e attivo.’);

      }

    • This topic was modified 2 years, 4 months ago by spinaa.
Viewing 1 replies (of 1 total)
  • Hi there @spinaa,

    Helping out with custom coding of this nature is outside the scope of support, although I would recommend the following:

    1. Running the exact question you’re asking, along with the code provided, through an AI platform like ChatGPT for recommendations/changes to your code;
    2. Joining our WooCommerce Slack community (it does have a developer channel where you can ask coding questions): https://woo.com/community-slack/

    Hope it helps!

Viewing 1 replies (of 1 total)

The topic ‘Express checkout button’ is closed to new replies.