1

When I create an instance of Shippo::Transaction, I get access to transaction pdf from label_url field. How can I get access to pdf for return label?

I tried to create an instance of Shippo::Shipment with address_return or/and return_of fields and I received any link to my return label pdf from API response. I can do it only using web version.

I haven't found anything about this issue in API documentation.

1 Answers1

0

Check out the Shippo return label docs.

The process of creating a return label is the same as the outbound label, just with the addition of the return_of field in the Shipment.

  1. Create a Shippo::Shipment with return_of set to the object_id of the outbound Transaction object.
  2. Purchase one of the returned rates by creating a Shippo::Transaction.

(Altrnatively you can also purchase return labels in one API call with the Shippo Single Label Call Creation.)

Simon Kreuz
  • 575
  • 3
  • 8
  • for some reason this both solution doesn't work for me. When I try to create return label in one API call with this params `foo = Shippo::Transaction.create(shipment: "04246b7be7004ae5a60a5c9e32aca124", carrier_account: "ce24d26c1bba45ddb7204e212e517708", servicelevel_token: "usps_priority")` I get `Shippo::APIError: error: 500 Internal Server Error

    Server Error (500)

    `
    – Mike Bohoslavskyi Nov 28 '16 at 15:58
  • and when I'm trying to do it via new shipment `new_shipment = Shippo::Shipment.create(return_of: "921fd04dfff547b3ae5d955da67ccc69", address_to: previous_shipment[:address_from], address_from: previous_shipment[:address_to], parcel: previous_shipment[:parcel])` and then new transaction `new_transaction = Shippo::Transaction.create(rate: new_shipment.rates.first[:object_id], async: false)` I get transaction JSON object from API with error message `The given Rate can't be purchased because it's object_purpose is not PURCHASE.` – Mike Bohoslavskyi Nov 28 '16 at 16:05
  • @MykhailoBohoslavskyi would you mind posting your full API request or your Shippo username? Or feel free to just send it to support@goshippo.com. This allows us to look into the details and we can debug it much faster :) – Simon Kreuz Nov 29 '16 at 20:43