# ![](/assets/step3.882dd6eb157abc25c1f2895637ba8769f3b55aa52288a40e94bd0d9550a670c5.9c1bb791.svg) Purchase label The final step is to purchase the shipment. This will generate your shipping label. There are two ways to purchase a shipment. 1. You can [purchase the shipment object](#purchase-from-created-shipment) you created in the last step 2. You can purchase a label without a [shipment object in a single call](#purchase-label-in-one-call) ## HTTP Method POST ## URL ``` https://api.goshippo.com/transactions/ ``` ## Purchase from created Shipment This is a flow where we first create a shipment object (and get rates for a given shipment). Then, we purchase a label for the provided `rate`. ### Request Payload | Parameter | Description | | --- | --- | | rate* | `object_id` of the rate object we get in the [create shipments call response](/docs/carriers/integration_guides/bettertrucks/create_shipment#request-sample-for-a-shipment). | | label_file_type* | Allowed values: `PDF`, `PDF_A4`, `PDF_A6`, `PDF_4x6`, `PDF_4x8`, `PDF_SINGLE_8X11`, `PDF_2.3x7.5`, `PNG`, `PNG_2.3x7.5`, `ZPLII` | | | | Note: Parameters with an * are mandatory ### Example #### Request Sample ```shell curl --location --request POST 'https://api.goshippo.com/transactions' \ --header 'Authorization: ShippoToken shippo_live_***’ \ --header 'Content-Type: application/json' \ --data-raw '{ "rate": "4af61f01e2a44ecbb6c278a1d573f1ff", "async": false, "label_file_type": "PDF" }’ ``` #### Response Sample ```json { "object_state": "VALID", "status": "SUCCESS", "object_created": "2023-02-01T09:38:24.238Z", "object_updated": "2023-02-01T09:38:27.042Z", "object_id": "48ee2ce651894bf3bb37f1af0612bd6a", "object_owner": "expn-prod-test@shippo.com", "test": true, "rate": "4af61f01e2a44ecbb6c278a1d573f1ff", "tracking_number": "BTS_001807L4NVV", "tracking_status": "UNKNOWN", "eta": null, "tracking_url_provider": "https://tracking.bettertrucks.com/Tracking?ShipmentId=jhfBTS_001807L4NVV", "label_url": "https://dev-qa-deliver.shippodev.com/48ee2ce651894bf3bb37f1af0612bd6a.pdf?Expires=1706780306&Signature=OFKPm1PuMuFJKVEnVXAkfw-gJ2SsJmUN1VzeZ66VCUj5r~rmOp5ze~XvEhQTGKR8YjWTjv0dVg3Mo1h9sgQBQmVdPZ0tXIgr1g1NVcGrSYf6duqvv~IczKvdtA2aI2lkMvT-Q4Kb1KvdW37dnJTzCGB2jJBNnz-N44n2j4JEpuNc-Iq6jJlJXPAJHKJPLVAxoI77klfthSSzRN0reCfItSCybDs1a~F2PQ1rKl-wf~60en419OI4JR0C0E-aUjaz~EvBh8e2gBvAU-rmxsB13yJiAI3WtTayCIlATAJ5svdiLvZiKAn6oWkOtwQ6rnX3OcOPVJh1mCUCymvTxdGAgg__&Key-Pair-Id=APKAJKRDBHOMWKB2OAVQ", "commercial_invoice_url": null, "messages": [], "order": null, "metadata": "", "parcel": "ea911c30d3904d9881ebbe698c6d0cca", "billing": { "payments": [] }, "qr_code_url": null } ``` This is an example of the label that is created. ![Sample label created using a Shipment object](/assets/sample_label_with_shipment_obj.4b1965adb75b57c488375a3c4a2886fd58dbbad380839a66b4af3b2f6d422f39.594db778.png) ## Purchase label in one call This is a flow where we create a shipment object from the request payload and return label for it in one call ### Request Payload | Parameter | Description | | --- | --- | | shipment* | [Refer to the Shipment object](#shipment). | | carrier_account* | `object_id` of the carrier account to be used for purchasing this label. This carrier account object_id is available when an account is created. | | servicelevel_token* | Name of the service level to use. For now, only `better_trucks_next_day` is supported. This are case sensitive. | | label_file_type* | Allowed values: `PDF`, `PDF_A4`, `PDF_A6`, `PDF_4x6`, `PDF_4x8`, `PDF_SINGLE_8X11`, `PDF_2.3x7.5`, `PNG`, `PNG_2.3x7.5`, ZPLII | ### Shipment | Parameter | Description | | --- | --- | | address_from* | [Refer to the Address object](/docs/carriers/integration_guides/bettertrucks/create_shipment#address) | | address_to* | [Refer to the Address object](/docs/carriers/integration_guides/bettertrucks/create_shipment#address) | | parcels* | List of Parcel objects. [Refer Parcel object](/docs/carriers/integration_guides/bettertrucks/create_shipment#parcel) | | extra | [Refer to the Extra object](/docs/carriers/integration_guides/bettertrucks/create_shipment#extra) | ### Examples #### Request sample for a shipment in one call ```shell curl --location --request POST 'https://api.goshippo.com/transactions' \ --header 'Authorization: ShippoToken shippo_live_******' \ --header 'Content-Type: application/json' \ --data-raw '{ { "shipment": { "address_from": { "name": "Mr. Hippo", "company": "Shippo & Son", "street1": "1901 W Madison Street", "street2": "Press Box 23", "city": "Chicago", "state": "IL", "zip": "60612", "country": "US", "phone": "+1 555 341 9393", "email": "support@shippo.com" }, "address_to": { "name": "Mrs. Hippo", "company": "Shippo & Co", "street1": "100 STOCKYARD", "city": "Nashville", "state": "TN", "zip": "37201", "country": "US", "metadata": "Customer ID 123456" }, "parcels": [ { "weight": "8", "length": "9", "width": "9", "height": "8", "distance_unit": "in", "mass_unit": "lb" } ], "extra": { "signature_confirmation": true, "alcohol": { "contains_alcohol": false } } }, "carrier_account": "{{BETTER_TRUCKS_ACC}}", "async": false, "servicelevel_token": "better_trucks_next_day", "label_file_type": "PDF_4x6" }' ``` #### Response sample for a shipment in one call ```json { "object_state": "VALID", "status": "SUCCESS", "object_created": "2023-01-26T09:52:08.935Z", "object_updated": "2023-01-26T09:52:11.715Z", "object_id": "09ae917f995e494fa3644d2681c4dbc7", "object_owner": "nataliya_eng@shippo.com", "test": false, "rate": { "object_id": "7df6b9381e424b21a682c49aea8c9614", "amount": "6.02", "currency": "USD", "amount_local": "6.02", "currency_local": "USD", "provider": "Better Trucks", "servicelevel_name": "Next Day", "servicelevel_token": "better_trucks_next_day", "carrier_account": "a00414e75df144b596673979108bbab5" }, "tracking_number": "BTS_0018FQYZ3H5", "tracking_status": "UNKNOWN", "eta": null, "tracking_url_provider": "https://tracking.bettertrucks.com/Tracking?ShipmentId=jhfBTS_0018FQYZ3H5", "label_url": "https://dev-qa-deliver.shippodev.com/09ae917f995e494fa3644d2681c4dbc7.pdf?Expires=1706262731&Signature=CtTyLLrL4PB4DD-o7-BTZ9jUB8p2XSCDHmWnZaMoVLFqfSwAsXCfy4MLNRqMceaRfz2uftvWeL5MgsL1TTElKUpuaawgBqaK6nFWj3cxVoWb94skkfiqzqPjqyIL9rsuKg6HxmKEjmQIDfGYjK3r3M2dTBfiauDTB4lueFmKSS41yLdV0JMeJT8y-SY13iBcKTelUMEHNwMiDGQV2D8Cag6nJoTAb-b7Ktw3ogO1xMprqCduv8MuwtvYiYPZfkHzmHdaGZ7YXGNGpH5IkeRvgUFYufzLXRfcYX0e-9d7joRTXmaIOcIRiNrZLdR9TVugg8b87LkciWMjJssCJ7ZW7g__&Key-Pair-Id=APKAJKRDBHOMWKB2OAVQ", "commercial_invoice_url": null, "messages": [], "order": null, "metadata": "", "parcel": "e03be392226849a3a4ee380a9aced3e2", "billing": { "payments": [] }, "qr_code_url": null } ``` This is an example of the label that is created. ![Example label created form a single call purchase](/assets/sample_label_with_single_call.a9c27f9c9715e1215324145baf1d38d4e846312f9d0c63ea4f88f946857d78a4.594db778.png) ## Response A successful response includes all the details about your purchased shipment including tracking details and a link to your shipping label.