x

How do I program my API to add the requested shipping info?

[The title of this thread has been edited from the original: Add tracking_number, carrier, and tracking_url to an order using UPDATE order API]

 

I use a 3rd party app to generate shipping label & I want to use the orders API To add the tracking info (carrier, tracking_number, tracking_url) using a sparse order object but I am getting a strange error: 

 

Orders with multiple fulfillments must specify the line items linked to each fulfillment using the ENTRY_LIST line_item_application type.

 

I am sending the following JSON payload:

 

{"idempotency_key": "xxxxxxxxxxxxxxxxx", "order":{"version": X, "fulfillments": [{"shipment_details": {"carrier": "USPS", "tracking_number":"XXXX", "tracking_url": "XXXX"}}]}}

 

To the following endpoint: 

 

PUT https://connect.squareup.com/v2/locations/ABC/orders/XYZ

 

Thank you for your help! 

1,507 Views
Message 1 of 5
Report
4 REPLIES 4
Alumni

Hello @donutshoppe,

 

Thanks for posting in the Seller Community. 

 

I'd love to gather more information on this, but before I do, I have a couple of clarifying questions.

 

 

First, what 3rd party app are you using? Second, do you have a website that your customer's use to take orders from? If so, please send the URL here in a thread. Thank you.

 

 

I'll keep an eye out for your reply. 

Alex_
Community Moderator, Square // Moderador de la Comunidad, Square
Sign in and click Mark as Best Answer if my reply answers your question.
Inicie seción y haga clic en Marcar como "Mejor Respuesta" si mi respuesta contesta su pregunta.
1,468 Views
Message 2 of 5
Report

I am using an application that I created called Rhythmic Equations (rhythmicequations.com) that integrates with Easypost to create shipping labels for Discogs orders. The app syncs Discogs inventory with Square inventory so we just started getting some orders via the built-in Square Online Store.

 

So now we want to finish building the ability to fulfill both Square and Discogs orders via Rhythmic Equations. I was able to bring in the Square online orders & shipping info, but I'm having some trouble when adding shipping info and updating status of the order. 

 

Appreciate your time. 

 

 

1,443 Views
Message 3 of 5
Report
Alumni

Hi @donutshoppe,

 

Thank you for your patience. We escalated this up to our API team and they relayed a couple of things.

 

With the JSON payload provided, there are a couple errors.

  1. Within fulfillments you need to pass a type of SHIPMENT.
  2. Within shipment_details you also need to pass recipient with at least display_name

That would be enough to get it to work successfully, but there wouldn’t be any items attached to it since they are also not passing line_items.

 

Also, provided is a full working example.

 

{
"idempotency_key": "XXXXXX",
"order":
{"fulfillments":
[
{
"type": "SHIPMENT",
"shipment_details":
{
"carrier": "USPS",
"tracking_number":"XXXX",
"tracking_url": "XXXX",
"recipient": {
"display_name": "John Doe"
}
}
}
]
}
}

 

 

If you are still experiencing issues, we recommend contacting our API team directly via email through this contact from. This will insure you get your question escalated to a specialist that can specifically look into your account details. 

 

Let us know if you have any other questions by replying in this thread. 

Alex_
Community Moderator, Square // Moderador de la Comunidad, Square
Sign in and click Mark as Best Answer if my reply answers your question.
Inicie seción y haga clic en Marcar como "Mejor Respuesta" si mi respuesta contesta su pregunta.
1,399 Views
Message 4 of 5
Report

Thanks a lot for your response. I did end up opening a case and it appears I was also missing the fulfillment uid in the fulfillments object. This ended up being the working JSON payload in case anyone else runs into this issue: 

 

When moving an order from PROPOSED or RESERVED state to COMPLETED while populating the tracking info send JSON payload:

 

{"idempotency_key": "xxxxxxxxxxxxxxxx", "order":{"version": X, "fulfillments": [{"uid": "xxxxxxxxxxxxxxxxxxxxx", "shipment_details": {"carrier": "U.S. Postal Service", "tracking_number":"XYZ", "tracking_url": "https://", "shipped_at": "2020-03-30T19:18:42.699Z", "in_progress_at": "2020-03-29T01:22:06.971Z"}, "state": "COMPLETED"}], "state": "COMPLETED"}}

 

to PUT https://connect.squareup.com/v2/locations/XYZ/orders/123 endpoint

 

Thanks for your team's very prompt support. 

1,392 Views
Message 5 of 5
Report