I am trying to create shippo batch labels using java API. I have specified carrier objectID at BatchShipment
level and at Batch
level. When I check status of batch - it is Invalid
, batch shipment status is also Invalid
and there is message in batch shipment object: "Carrier account with the provided object_id does not exist". Do you have ideas why I am receiving this error?
Carrier object id was received by requesting all CarrierAccounts, here is kotlin snippet:
Shippo.apiKey = ShippoSnippet.SHIPPO_API_KEY
val all = CarrierAccount.all()
print(all.data.firstOrNull{it.carrier.toLowerCase().contains("usps")}!!.objectId)
//output is 50c0caf41f9b450ebe62f24daf2615be
Here is snippet how I specify carrier account at shipment level:
BatchShipment.createForShipment(shipment, "50c0caf41f9b450ebe62f24daf2615be", "usps_first")
.
Batch was created:
val submitted = Batch.create("50c0caf41f9b450ebe62f24daf2615be", "usps_first", LabelFileType.PDF, null, batchShipments.toTypedArray())
val shippoId = submitted.id
Then I request batch object again with this snippet:
Batch.get(shippoId, 0, null)
But result is invalid and I am not sure why because I specify carrier objectId
, as it written in API docs.
Shippo support confirmed they have this issue with test key at current moment. It worked for me with live key.