Best answer

"message" error: "Invalid JSON"

  • 13 June 2020
  • 1 reply
  • 140 views

I am integrating with BOOKEO, I am using a POST function, but I am getting the following "message" error: "Invalid JSON", which may be the problem. Thank you

 

const options = {
  url: 'https://api.bookeo.com/v2/bookings/1556006123381863/payments?',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json'
  },
  params: {
    'secretKey': '',
    'apiKey': ''
  },
  body: {
    'paymentMethod': 'cash',
    'reason': 'prueba',
    'amount': '85000'
  }
}

return z.request(options)
  .then((response) => {
    response.throwForStatus();
    const results = response.json;

    // You can do any parsing you need for results here before returning them

    return results;
  });

icon

Best answer by David Mercer 17 June 2020, 18:35

@baruc You JSON is formatted correctly, but it is not valid for POSTing to a booking payment.  Take a look at the API documentation of the fields required for this JSON: https://www.bookeo.com/apiref/index.html#!/Bookings/bookings__bookingNumber__payments_post

David

View original

1 reply

Userlevel 2
Badge

@baruc You JSON is formatted correctly, but it is not valid for POSTing to a booking payment.  Take a look at the API documentation of the fields required for this JSON: https://www.bookeo.com/apiref/index.html#!/Bookings/bookings__bookingNumber__payments_post

David

Reply