I keep getting this error when executing a transaction on rate object id's that were created a few days ago.
{
"source": "USPS",
"code": "",
"text": "The selected shipment date must be within 7 days of 02/15/2017, 07:11PM CST."
}
Im integrating shippo with my Node.js web application. I am using shippo node.js library.
shippo.shipment.create({, function(err, shipment) {});
I built a basic store. When user gets to checkout section, I get rates from shippo. I display those rates to the user. The user chooses which rate he wants. I save the rate object id to a database.
shippo.transaction.create({, function(err, transaction) {});
I fulfill the order and print the shipping label. The application goes to the database and retrieves rate object id to execute the transaction with shippo. In return Im suppose to get a tracking # and label information, but instead I get the error.
I first thought that the rate object id only last 7 days and then expires on its own or something. When I checked the rate object id:
https://api.goshippo.com/rates/2a0b50cbc5184362a0ea2385b490bc7b
It shows object was created 2/18. Today is the 2/21. So that cant be. The error says "The selected shipment date must be within 7 days of 02/15/2017, 07:11PM CST."
What does it mean? Why did I get it?
It seems to only happen to rate object id's that were create 2+ days ago. If the rate object id was created yesterday, I could still execute the transaction no problem.
It looks like you are using a rate from the past (not the same day) that is causing this error to occur.
When you make a shipment at the /shipments/
endpoint, you are able to specify the submission_date
when creating the shipment. If you do not specify the submission_date
(you would generally only do this if you know the day you plan on shipping the item out), Shippo automatically sets the submission_date
to the date the request is being made.
The reason that you are getting an error, is that you're using a rate for a shipment that has a submission_date
in the past. Some carriers will only permit a submission date that is the current date, or some date in the future.
You can find more details here on the shipment object that might help.