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

187
Vistas
PayPal JS SDK server integration - including additional parameters

I wanted to integrate the new JS button. I'm on this page trying to figure out how to do this. I understand how it's supposed to work, but I don't get how to call a server script to handle the database updates.

It seems this line:

return fetch('/demo/checkout/api/paypal/order/' + data.orderID + '/capture/', {method: 'post'}

is calling a script, but how can I include arguments?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In the line you quote, the content of data.orderID becomes a path (URL) argument, and that URL is fetched. This URL needs to be a route on your server.

If you want to pass additional arguments, or put the order ID in the body of the request instead of the URL, you can do so. Use body in the options to fetch, and give it a JSON object/string. Something like:

return fetch('/path/on/your/server/to/capture/order', {
  method: 'POST',
  body: {
    id: data.orderID,
    your_argument_name: 'some data';
  }
});

On the server end handling the route, you'll need to deserialize that JSON object. Plenty of guides out there on how to read JSON input for whatever backend environment you're using (notably you do not use PHP's $_POST as that is for form encoded data only)

about 4 years ago · Juan Pablo Isaza 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