Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda