Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Shipment object in Shippo returns objects in Queued status

Tags:

php

shippo

We are using the Shippo api via the provided PHP library for our project.

When creating a shipment object, it is being returned with a "Queue" status and, although a rate url is given, the rates_list array is empty.

Trying to understand a few things:

  • Why is it queued
  • How do we know when it is un-queued
  • Why is there no rates_list
like image 678
Mikhail Avatar asked Aug 24 '16 23:08

Mikhail


1 Answers

By default, the Shippo API returns rates and labels asynchronously. Asynchronous responses mean that Shippo won't be returning rates or label you have requested immediately. After your Rates or Label API POST call, you will get a successful response from the Shippo API, but without the actual rates or label. This allows your implementation to do other tasks while Shippo is retrieving your data.

  • "Queued" shipments are currently being processed.
  • "Success" shipments have been processed successfully, meaning that rate generation has concluded.

You need to continue to check the URL for when the status changes to Success at which point all of the information will be available.

If you want to not use async responses, in the current API version, you need to explicitly opt into sync responses by setting the async parameter in the POST body to false.

like image 150
Mikhail Avatar answered Oct 14 '22 06:10

Mikhail