Hi and thanks for setting up this forum for helping developers.
I seem to be having an issue creating an order with pickup fulfillment and the error I’m getting is, unfortunately, providing no help. Please see below for all the details (in JavaScript/JSON) and thank you for reading.
POST Request:
const squareOrder = {
fulfillments: [
{
pickup_details: {
recipient: { display_name: name, phone_number },
schedule_type: "ASAP",
note: notes,
},
state: "COMPLETED",
type: "PICKUP",
uid: id,
},
],
line_items: manifest_items.map((mi) => {
const { name, quantity, size, additional_data } = mi;
return {
quantity: `${quantity}`,
name,
note: `${additional_data}`,
variation_name: size,
};
}),
reference_id: id,
source: `${provider} ${integration_name}`,
};
const data = {
idempotency_key: id,
order: squareOrder,
};
axios.post(
`https://connect.squareupsandbox.com/v2/locations/${location_id}/orders`,
data,
{
headers: {
Authorization: `Bearer ${access_token}`,
"Square-Version": "2020-04-22",
"Content-Type": "application/json",
},
}
)
Error:
[
{
code: 'BAD_REQUEST',
detail: 'Expected "{" (line 1, character 391)',
category: 'INVALID_REQUEST_ERROR'
}
]
Hopefully, this code will be formatted correctly in my post and the error will be an instant light switch for someone because I have no idea what it could possibly be. Thank you.