Best answer

"message" error: "Invalid JSON"

  • 13 June 2020
  • 1 reply
  • 176 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

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

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