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

172
Vistas
PayPal server integration does not pass data via the fetch body parameter

I'm following PayPal's server integration demo: https://developer.paypal.com/demo/checkout/#/pattern/server

The following code does not appear to be passing data via the "body" parameter:

      createOrder: function(data, actions) {
            return fetch('/paypal_api', {
                method: 'post',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({name:"sammy"}),
            }).then(function(res) {
                return res.json();
            }).then(function(orderData) {
                return orderData.id;
            });
        },

I am, however, able to pass parameters within the URL. For example:

return fetch('/paypal_api/<some_variable>/', {

So I can get this working but am bugged that the POST method does not appear to be working as expected. Here's a snippet from my python server code:

class createOrder(webapp2.RequestHandler): def get(self):

    print self.request.params

... and the print statement returns nothing (UnicodeMultiDict([])).

I'm 99% certain that I'm missing something obvious since google is not helping me! :)

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

0

Parse the request body as JSON

import json

jsonstring = self.request.body
jsonobject = json.loads(jsonstring)
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