Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
Javascript anonymous function parameters

i am just learning how to code javascript. got confused by this chunk of code. from my reading function(data, actions) is an anonymous function that passes two parameters to the function body. however, i don't see "data" being referenced anywhere inside the function. am i reading it wrong?

<script>
  paypal.Buttons({
    createOrder: function(data, actions) {
      // Set up the transaction
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '0.01'
          }
        }]
      });
    }
  }).render('#paypal-button-container');
</script>
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

All the PayPal JS SDK callback functions have two parameters, data and actions. This is just the name/convention the SDK chooses to use for those parameters' names.

When creating a PayPal order or subscription on button click there isn't anything useful in the data object, so you won't find samples that make use of it -- but if you wanted to check its contents while developing you can log it to your browser console with something like:

        createOrder: function(data, actions) {
            console.log("createOrder data param", data, JSON.stringify(data,null,2) );
            return actions.order.create({
                purchase_units: [{
                    amount: {
                        value: '0.01'
                    }
                }]
            });
        }
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda