goshippo / shippo-node-client

Shipping API Node.js library (USPS, FedEx, UPS and more)
https://goshippo.com/docs
MIT License
136 stars 54 forks source link

Getting "The data you sent was not accepted as valid" on valid Rate ID #66

Open jousi592 opened 3 years ago

jousi592 commented 3 years ago

I am trying to test your transactions endpoint to purchase a label, however it keeps returning that my data was not valid. Which is strange, because when I fetch the shipment by ID, I can clearly see that it contains the rate that I am trying to purchase. Is there something I am missing?

This is what I am sending: { rate: 'a56493b1f836482e94b89fb9d6261267', label_file_type: 'PDF', async: false } This is my implementation:

shippo_instance.transaction.create({
    rate: rate_id,
    label_file_type: "PDF",
    async: false
  }, async (error, transaction) => {
    if (error) return res.send(create_api_message("danger", error.message))

    try {
      const label = await shippo_instance.transaction.retrieve(transaction.object_id);

      res.send(label)
    } catch ({ message }) {
      res.send(create_api_message("danger", message))
    }
  });
babyrusa commented 3 years ago

Having the same issue too. I think the api mistakens this call with the Instant label call (https://goshippo.com/docs/reference/js#transactions-create-instant) but idk how to fix

babyrusa commented 3 years ago

@jousi592 have u figured out the fix for this?

babyrusa commented 3 years ago

after all this time, turned out I was missing sender/reciever name when creating shipment. So make sure to doube check your name and address. I pretended to enter a non-existing address but it worked too? I guess it does not care if we enter the wrong address