### Create Live Rate at Checkout (C#) Source: https://docs.goshippo.com/spec/shippoapi/public-api.yaml Example of creating a live rate at checkout using the Shippo SDK in C#. Requires the SDK to be installed and configured. ```csharp var res = await sdk.RatesAtCheckout.CreateAsync( liveRateCreateRequest: new LiveRateCreateRequest() { AddressFrom = LiveRateCreateRequestAddressFrom.CreateStr( "" ), AddressTo = LiveRateCreateRequestAddressTo.CreateAddressCompleteCreateRequest( new AddressCompleteCreateRequest() { Name = "Shwan Ippotle", Company = "Shippo", Street1 = "215 Clayton St.", Street3 = "", StreetNo = "", City = "San Francisco", State = "CA", Zip = "94117", Country = "US", Phone = "+1 555 341 9393", Email = "shippotle@shippo.com", IsResidential = true, Metadata = "Customer ID 123456", Validate = true, } ), LineItems = new List() { new LineItem() { Currency = "USD", ManufactureCountry = "US", MaxDeliveryTime = System.DateTime.Parse("2016-07-23T00:00:00Z"), MaxShipTime = System.DateTime.Parse("2016-07-23T00:00:00Z"), Quantity = 20, Sku = "HM-123", Title = "Hippo Magazines", TotalPrice = "12.1", VariantTitle = "June Edition", Weight = "0.4", WeightUnit = WeightUnitEnum.Lb, ObjectId = "abf7d5675d744b6ea9fdb6f796b28f28", }, }, Parcel = LiveRateCreateRequestParcel.CreateStr( "5df144dca289442cv7a06" ), }, shippoApiVersion: "2018-02-08" ); // handle response ``` -------------------------------- ### Create Manifest using Python SDK Source: https://docs.goshippo.com/spec/shippoapi/public-api.yaml Python code to create a manifest. This example includes detailed address information and transaction IDs. Ensure the Shippo SDK is installed. ```python import shippo from shippo.models import components s = shippo.Shippo( api_key_header='ShippoToken ', shippo_api_version='2018-02-08', ) res = s.manifests.create(request=components.ManifestCreateRequest( carrier_account='adcfdddf8ec64b84ad22772bce3ea37a', shipment_date='2014-05-16T23:59:59Z', transactions=[ 'adcfdddf8ec64b84ad22772bce3ea37a', ], address_from=components.AddressCreateRequest( name='Shwan Ippotle', company='Shippo', street1='215 Clayton St.', street3='', street_no='', city='San Francisco', state='CA', zip='94117', country='US', phone='+1 555 341 9393', email='shippotle@shippo.com', is_residential=True, metadata='Customer ID 123456', validate=True, ), )) if res is not None: # handle response pass ``` -------------------------------- ### Get Carrier Registration Status (PHP) Source: https://docs.goshippo.com/api-reference/carrier-accounts/get-carrier-registration-status This PHP example utilizes the Shippo API builder to set up the SDK for retrieving carrier registration status. Ensure you have the Shippo PHP library installed via Composer. ```php declare(strict_types=1); require 'vendor/autoload.php'; use Shippo\API; use Shippo\API\Models\Operations; $sdk = API\Shippo::builder() ->setSecurity( 'ShippoToken ' ) ->setShippoApiVersion('2018-02-08') ->build(); ``` -------------------------------- ### Full Shippo Widget Initialization Example Source: https://docs.goshippo.com/docs/ShippingElements/install Provides a complete example of the `init()` method, demonstrating how to pass required parameters like token and org, along with optional parameters for locale and theme customization. ```javascript shippo.init({ token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', org: 'john-doe-industries', locale: 'fr-CA', theme: { width: '100%', }, }); ``` -------------------------------- ### Full Example: Install, Init, and Purchase Label Source: https://docs.goshippo.com/docs/ShippingElements/install This HTML and JavaScript code snippet shows how to include the Shippo embeddable client, initialize it with your token and organization details, and then trigger a label purchase when a button is clicked. Ensure the `shippo` object is available before calling its methods. ```html Web Application
``` -------------------------------- ### Retrieve a Rate using PHP Source: https://docs.goshippo.com/api-reference/rates/retrieve-a-rate This PHP code retrieves a rate using the Shippo SDK. Ensure you have installed the SDK via Composer. The example shows how to build the SDK client and call the `get` method for rates. ```php declare(strict_types=1); require 'vendor/autoload.php'; use Shippo\API; $sdk = API\Shippo::builder() ->setSecurity( 'ShippoToken ' ) ->setShippoApiVersion('2018-02-08') ->build(); $response = $sdk->rates->get( rateId: '', shippoApiVersion: '2018-02-08' ); if ($response->rate !== null) { // handle response } ``` -------------------------------- ### Get Tracking Status Source: https://docs.goshippo.com/api-reference/tracking-status/get-a-tracking-status This example demonstrates how to retrieve the tracking status for a shipment using the Shippo SDK. ```APIDOC ## Get Tracking Status ### Description Retrieves the tracking status for a shipment using the tracking number and carrier. ### Method GET ### Endpoint `/tracking-status/{tracking_number}/{carrier}` ### Parameters #### Path Parameters - **tracking_number** (string) - Required - The tracking number of the shipment. - **carrier** (string) - Required - The name of the carrier (e.g., `usps`). #### Query Parameters - **shippo_api_version** (string) - Optional - Specifies the API version to use. Defaults to the latest version. ### Request Example ```php $response = $sdk->trackingStatus->get( trackingNumber: '', carrier: '', shippoApiVersion: '2018-02-08' ); ``` ```java GetTrackResponse res = sdk.trackingStatus().get() .trackingNumber("") .carrier("") .shippoApiVersion("2018-02-08") .call(); ``` ### Response #### Success Response (200) - **tracking_number** (string) - The tracking number. - **carrier** (string) - The name of the carrier. - **tracking_status** (object) - The current tracking status. - **address_from** (object) - The origin address of the shipment. - **address_to** (object) - The destination address of the shipment. - **eta** (string) - The estimated time of arrival. - **original_eta** (string) - The original estimated time of arrival. - **servicelevel** (object) - The service level of the shipment. - **tracking_history** (array) - A list of tracking events. - **messages** (array) - A list of messages related to the tracking. - **metadata** (string) - Additional metadata. - **transaction** (string) - The ID of the associated transaction. #### Response Example ```json { "tracking_number": "9205590164917312751089", "carrier": "usps", "tracking_status": { "code": "TRANSIT", "message": "In Transit", "subcode": null, "subcode_description": null, "created": "2023-10-26T10:00:00Z", "updated": "2023-10-26T10:00:00Z" }, "address_from": { "name": "John Doe", "street1": "123 Main St", "city": "Anytown", "state": "CA", "zip": "90210", "country": "US" }, "address_to": { "name": "Jane Smith", "street1": "456 Oak Ave", "city": "Otherville", "state": "NY", "zip": "10001", "country": "US" }, "eta": "2023-10-30T00:00:00Z", "original_eta": "2023-10-29T00:00:00Z", "servicelevel": { "token": "usps_priority_mail", "name": "Priority Mail", "token_parent": null }, "tracking_history": [ { "code": "PRE_TRANSIT", "message": "Pre-Shipment", "subcode": null, "subcode_description": null, "created": "2023-10-25T09:00:00Z", "updated": "2023-10-25T09:00:00Z" }, { "code": "TRANSIT", "message": "In Transit", "subcode": null, "subcode_description": null, "created": "2023-10-26T10:00:00Z", "updated": "2023-10-26T10:00:00Z" } ], "messages": [], "metadata": "Order 000123", "transaction": "txn_12345abcde" } ``` ``` -------------------------------- ### List All Manifests in C# Source: https://docs.goshippo.com/api-reference/manifests/list-all-manifests This C# example shows how to list manifests using the Shippo SDK. It demonstrates setting up the SDK with API credentials and calling the asynchronous list method. ```csharp using Shippo; using Shippo.Models.Components; var sdk = new ShippoSDK( apiKeyHeader: "ShippoToken ", shippoApiVersion: "2018-02-08" ); var res = await sdk.Manifests.ListAsync( page: 1, results: 5, shippoApiVersion: "2018-02-08" ); ``` -------------------------------- ### Create Batch Example Source: https://docs.goshippo.com/api-reference/batches/create-a-batch This example demonstrates how to construct and send a request to create a batch of shipments. ```APIDOC ## POST /v1/batches ### Description Creates a new batch of shipments. Batches allow you to process multiple shipments in a single API call. ### Method POST ### Endpoint /v1/batches ### Request Body - **shipment_configs** (array) - Required - A list of shipment configurations to include in the batch. - **carrier_account** (string) - Required - The token of the carrier account to use for the shipment. - **servicelevel_token** (string) - Required - The token of the service level to use for the shipment. - **metadata** (string) - Optional - Arbitrary data to store with the shipment. - **customs_declaration** (object) - Optional - Details for customs declaration if shipping internationally. - **non_delivery_option** (string) - Optional - Specifies the action to take if the shipment cannot be delivered. - **b13a_filing_option** (string) - Optional - Indicates if the B13A filing has been completed. - **contents_explanation** (string) - Optional - A detailed explanation of the shipment contents. - **duties_payor** (object) - Optional - Information about who is responsible for duties. - **account** (string) - Required - The account number of the duties payor. - **type** (string) - Required - The type of the duties payor (e.g., THIRD_PARTY). - **address** (object) - Required - The address of the duties payor. - **name** (string) - Required - The name of the duties payor. - **zip** (string) - Required - The zip code of the duties payor. - **country** (string) - Required - The country code of the duties payor. - **exporter_identification** (object) - Optional - Identification details for the exporter. - **eori_number** (string) - Optional - The EORI number of the exporter. - **tax_id** (object) - Optional - Tax identification details for the exporter. - **number** (string) - Required - The tax ID number. - **type** (string) - Required - The type of tax ID (e.g., EIN). - **invoice** (string) - Optional - The invoice number associated with the shipment. - **metadata** (string) - Optional - Arbitrary data to store with the customs declaration. - **address_importer** (object) - Required - The importer's address. - **name** (string) - Required - The importer's name. - **company** (string) - Optional - The importer's company name. - **street1** (string) - Required - The first line of the importer's street address. - **street3** (string) - Optional - The third line of the importer's street address. - **street_no** (string) - Optional - The street number of the importer's address. - **city** (string) - Required - The importer's city. - **state** (string) - Optional - The importer's state or province. - **zip** (string) - Required - The importer's zip or postal code. - **country** (string) - Required - The importer's country code. - **phone** (string) - Optional - The importer's phone number. - **email** (string) - Optional - The importer's email address. - **is_residential** (boolean) - Optional - Indicates if the address is residential. - **eel_pfc** (string) - Optional - Electronic Export Information (EEI) or Proof of Filing Citation (PFC) code. - **incoterm** (string) - Optional - The Incoterm for the shipment. - **test** (boolean) - Optional - Set to true to test the customs declaration without creating a real one. - **label_filetype** (string) - Required - The desired file type for the shipping label (e.g., PDF4X6). - **metadata** (string) - Optional - Arbitrary data to store with the batch. ### Request Example ```json { "shipment_configs": [ { "carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3", "servicelevel_token": "fedex_ground", "metadata": "SHIPMENT #1", "customs_declaration": { "non_delivery_option": "RETURN", "b13a_filing_option": "FILED_ELECTRONICALLY", "contents_explanation": "T-Shirt purchase", "duties_payor": { "account": "2323434543", "type": "THIRD_PARTY", "address": { "name": "Patrick Kavanagh", "zip": "80331", "country": "DE" } }, "exporter_identification": { "eori_number": "PL123456790ABCDE", "tax_id": { "number": "123456789", "type": "EIN" } }, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": { "name": "Shwan Ippotle", "company": "Shippo", "street1": "Blumenstraße", "street3": "", "street_no": "22", "city": "München", "state": "CA", "zip": "80331", "country": "DE", "phone": "80331", "email": "shippotle@shippo.com", "is_residential": true }, "eel_pfc": "NOEEI3037_A", "incoterm": "DDP", "test": true } } ], "carrier_accounts": [ "065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0" ], "label_filetype": "PDF4X6", "metadata": "BATCH #1" } ``` ### Response #### Success Response (200) - **batch_id** (string) - The unique identifier for the created batch. - **status** (string) - The current status of the batch (e.g., QUEUED, PROCESSING, COMPLETED, FAILED). - **created_at** (string) - The timestamp when the batch was created. - **label_url** (string) - A URL to download the batch's shipping labels. #### Response Example ```json { "batch_id": "b1234567890abcdef1234567890abcdef", "status": "QUEUED", "created_at": "2023-10-27T10:00:00Z", "label_url": "https://api.shippo.com/v1/batches/b1234567890abcdef1234567890abcdef/label" } ``` ``` -------------------------------- ### Get Default Parcel Template Source: https://docs.goshippo.com/api-reference/rates-at-checkout/show-current-default-parcel-template This example demonstrates how to retrieve the default parcel template using the Shippo SDK. ```APIDOC ## GET /v1/parcel-templates/default ### Description Retrieves the default parcel template for the authenticated account. ### Method GET ### Endpoint /v1/parcel-templates/default ### Parameters #### Query Parameters - **shippo_api_version** (string) - Optional - Specifies the API version to use. Defaults to the latest stable version. ### Response #### Success Response (200) - **object_id** (string) - Unique identifier of the parcel template. - **name** (string) - The name of the parcel template. - **length** (string) - The length of the package. - **width** (string) - The width of the package. - **height** (string) - The height of the package. - **distance_unit** (string) - The unit of measurement for length, width, and height (e.g., IN, CM). - **weight** (string) - The weight of the package. - **weight_unit** (string) - The unit of measurement for weight (e.g., LB, KG). - **object_created** (string) - Date and time of parcel template creation. - **object_updated** (string) - Date and time of last update. - **object_owner** (string) - Username of the user who created the parcel template. #### Response Example ```json { "object_id": "b958d3690bb04bb8b2986724872750f5", "name": "My Custom Template", "length": "10", "width": "6", "height": "4", "distance_unit": "IN", "weight": "12", "weight_unit": "LB", "object_created": "2013-12-11T19:38:09.729Z", "object_updated": "2013-12-12T19:38:09.729Z", "object_owner": "shippotle@shippo.com" } ``` ``` -------------------------------- ### PHP SDK Example Source: https://docs.goshippo.com/api-reference/rates-at-checkout/generate-a-live-rates-request Example of how to generate a live rates request using the PHP SDK. ```APIDOC ## POST /v2/rates-at-checkout/live-rates ### Description Generates a live rates request to retrieve shipping rates for a checkout. ### Method POST ### Endpoint /v2/rates-at-checkout/live-rates ### Request Body - **address_from** (object) - Required - The sender's address details. - **address_to** (object) - Required - The recipient's address details. - **line_items** (array) - Required - A list of items included in the shipment. - **parcel** (string) - Required - The ID of the parcel to be shipped. ### Request Example ```json { "address_from": "", "address_to": { "name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true }, "line_items": [ { "currency": "USD", "manufacture_country": "US", "max_delivery_time": "2016-07-23T00:00:00Z", "max_ship_time": "2016-07-23T00:00:00Z", "quantity": 20, "sku": "HM-123", "title": "Hippo Magazines", "total_price": "12.1", "variant_title": "June Edition", "weight": "0.4", "weight_unit": "LB", "object_id": "abf7d5675d744b6ea9fdb6f796b28f28" } ], "parcel": "5df144dca289442cv7a06" } ``` ### Response #### Success Response (200) - **live_rate_paginated_list** (object) - A list of live rates. #### Response Example ```json { "live_rate_paginated_list": [ // ... rate details ... ] } ``` ``` -------------------------------- ### Get Batch Details in Java Source: https://docs.goshippo.com/spec/shippoapi/public-api.yaml Example of retrieving batch data with the Shippo Java SDK. Includes pagination parameters. ```java package hello.world; import com.goshippo.shippo_sdk.Shippo; import com.goshippo.shippo_sdk.models.operations.GetBatchResponse; import java.lang.Exception; public class Application { public static void main(String[] args) throws Exception { Shippo sdk = Shippo.builder() .apiKeyHeader("ShippoToken ") .shippoApiVersion("2018-02-08") .build(); GetBatchResponse res = sdk.batches().get() .batchId("") .page(1L) .results(5L) .shippoApiVersion("2018-02-08") .call(); if (res.batch().isPresent()) { // handle response } } } ``` -------------------------------- ### Java SDK Example Source: https://docs.goshippo.com/api-reference/rates-at-checkout/generate-a-live-rates-request Example of how to generate a live rates request using the Java SDK. ```APIDOC ## POST /v2/rates-at-checkout/live-rates ### Description Generates a live rates request to retrieve shipping rates for a checkout. ### Method POST ### Endpoint /v2/rates-at-checkout/live-rates ### Request Body - **address_from** (object) - Required - The sender's address details. - **address_to** (object) - Required - The recipient's address details. - **line_items** (array) - Required - A list of items included in the shipment. - **parcel** (string) - Required - The ID of the parcel to be shipped. ### Request Example ```java package hello.world; import com.goshippo.shippo_sdk.Shippo; import com.goshippo.shippo_sdk.models.components.AddressCompleteCreateRequest; import com.goshippo.shippo_sdk.models.components.LineItem; import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequest; import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestAddressFrom; import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestAddressTo; import com.goshippo.shippo_sdk.models.components.LiveRateCreateRequestParcel; import com.goshippo.shippo_sdk.models.components.WeightUnitEnum; import com.goshippo.shippo_sdk.models.operations.CreateLiveRateResponse; import java.lang.Exception; import java.time.OffsetDateTime; import java.util.List; public class Application { public static void main(String[] args) throws Exception { Shippo sdk = Shippo.builder() .apiKeyHeader("ShippoToken ") .shippoApiVersion("2018-02-08") .build(); LiveRateCreateRequest liveRateCreateRequest = LiveRateCreateRequest.builder() .addressFrom(LiveRateCreateRequestAddressFrom.builder() .build()) // Add sender address details here .addressTo(LiveRateCreateRequestAddressTo.builder() .name("Shwan Ippotle") .company("Shippo") .street1("215 Clayton St.") .street3("") .streetNo("") .city("San Francisco") .state("CA") .zip("94117") .country("US") .phone("+1 555 341 9393") .email("shippotle@shippo.com") .isResidential(true) .metadata("Customer ID 123456") .validate(true) .build()) .lineItems(List.of( LineItem.builder() .currency("USD") .manufactureCountry("US") .maxDeliveryTime(OffsetDateTime.parse("2016-07-23T00:00:00Z")) .maxShipTime(OffsetDateTime.parse("2016-07-23T00:00:00Z")) .quantity(20) .sku("HM-123") .title("Hippo Magazines") .totalPrice("12.1") .variantTitle("June Edition") .weight("0.4") .weightUnit(WeightUnitEnum.LB) .objectId("abf7d5675d744b6ea9fdb6f796b28f28") .build())) .parcel("5df144dca289442cv7a06") .build(); CreateLiveRateResponse response = sdk.ratesAtCheckout.create(liveRateCreateRequest); if (response.liveRatePaginatedList != null) { // handle response } } } ``` ### Response #### Success Response (200) - **live_rate_paginated_list** (object) - A list of live rates. #### Response Example ```json { "live_rate_paginated_list": [ // ... rate details ... ] } ``` ``` -------------------------------- ### Get Batch Details in C# Source: https://docs.goshippo.com/spec/shippoapi/public-api.yaml Fetches batch information using the Shippo C# SDK. Requires API key and version setup. ```csharp using Shippo; using Shippo.Models.Components; using Shippo.Models.Requests; var sdk = new ShippoSDK( apiKeyHeader: "ShippoToken ", shippoApiVersion: "2018-02-08" ); GetBatchRequest req = new GetBatchRequest() { BatchId = "", }; var res = await sdk.Batches.GetAsync(req); // handle response ``` -------------------------------- ### Get Customs Item - Java Source: https://docs.goshippo.com/spec/shippoapi/public-api.yaml Fetches a customs item by its ID. This example demonstrates how to initialize the Shippo SDK and make the API call in Java. ```java package hello.world; import com.goshippo.shippo_sdk.Shippo; import com.goshippo.shippo_sdk.models.operations.GetCustomsItemResponse; import java.lang.Exception; public class Application { public static void main(String[] args) throws Exception { Shippo sdk = Shippo.builder() .apiKeyHeader("ShippoToken ") .shippoApiVersion("2018-02-08") .build(); GetCustomsItemResponse res = sdk.customsItems().get() .customsItemId("") .page(1L) .shippoApiVersion("2018-02-08") .call(); if (res.customsItem().isPresent()) { // handle response } } } ``` -------------------------------- ### Create a Batch with Shipments Source: https://docs.goshippo.com/api-reference/batches/add-shipments-to-a-batch This example demonstrates how to create a batch and add shipments to it, including specifying parcel details, carrier accounts, and shipment-specific information like COD and insurance. ```python components.BatchCreateRequest( address_to='d799c2679e644279b59fe661ac8fa489', customs_declaration='adcfdddf8ec64b84ad22772bce3ea37a', carrier_accounts=[ '065a4a8c10d24a34ab932163a1b87f52', '73f706f4bdb94b54a337563840ce52b0', ], parcels=[ '', '', components.ParcelCreateFromTemplateRequest( extra=components.ParcelExtra( cod=components.Cod( amount='5.5', currency='USD', payment_method=components.PaymentMethod.CASH, ), insurance=components.ParcelInsurance( amount='5.5', content='Laptop', currency='USD', provider=components.ParcelInsuranceProvider.UPS, ), ), metadata='Customer ID 123456', mass_unit=components.WeightUnitEnum.LB, weight='1', template=components.ParcelTemplateUSPSEnum.USPS_SMALL_FLAT_RATE_ENVELOPE, ), ], ), components.BatchShipmentCreateRequest( carrier_account='a4391cd4ab974f478f55dc08b5c8e3b3', metadata='SHIPMENT #1', servicelevel_token='fedex_ground', shipment=components.ShipmentCreateRequest( extra=components.ShipmentExtra( accounts_receivable_customer_account=components.UPSReferenceFields( prefix='ABC', value='value', ref_sort=1, ), appropriation_number=components.UPSReferenceFields( prefix='ABC', value='value', ref_sort=1, ), bill_of_lading_number=components.UPSReferenceFields( prefix='ABC', value='value', ref_sort=1, ), cod=components.Cod( amount='5.5', currency='USD', payment_method=components.PaymentMethod.CASH, ), cod_number=components.UPSReferenceFields( prefix='ABC', value='value', ref_sort=1, ), customer_reference=components.CustomerReference( ref_sort=1, ), dealer_order_number=components.UPSReferenceFields( prefix='ABC', value='value', ref_sort=1, ), dept_number=components.DepartmentNumber( ref_sort=3, ), fda_product_code=components.UPSReferenceFields( prefix='ABC', value='value', ref_sort=1, ), insurance=components.Insurance( amount='5.5', currency='USD', ), invoice_number=components.InvoiceNumber( ref_sort=2, ), manifest_number=components.UPSReferenceFields( prefix='ABC', value='value', ref_sort=1, ), model_number=components.UPSReferenceFields( prefix='ABC', value='value', ref_sort=1, ), part_number=components.UPSReferenceFields( prefix='ABC', ``` -------------------------------- ### Install Shippo C# SDK Source: https://docs.goshippo.com/docs/Guides_general/ClientLibraries Install the C# SDK using NuGet. The source code is available on GitHub. ```csharp dotnet add package Shippo ``` -------------------------------- ### Get Customs Item - C# Source: https://docs.goshippo.com/spec/shippoapi/public-api.yaml Retrieves a specific customs item using its ID. Ensure you have the Shippo SDK installed and configured with your API token. ```csharp using Shippo; using Shippo.Models.Components; var sdk = new ShippoSDK( apiKeyHeader: "ShippoToken ", shippoApiVersion: "2018-02-08" ); var res = await sdk.CustomsItems.GetAsync( customsItemId: "", page: 1, shippoApiVersion: "2018-02-08" ); // handle response ``` -------------------------------- ### Create Order Source: https://docs.goshippo.com/api-reference/orders/create-a-new-order This example demonstrates how to create a new order with all necessary details, including currency, order information, addresses, and line items. ```APIDOC ## Create Order ### Description Creates a new order with specified details. ### Method POST (implied by SDK usage) ### Endpoint (Not explicitly defined in source, inferred from SDK method `shippo.orders.create`) ### Parameters #### Request Body - **currency** (string) - Required - The currency of the order (e.g., "USD"). - **notes** (string) - Optional - Additional notes for the order. - **orderNumber** (string) - Required - The unique number for the order. - **orderStatus** (string) - Required - The current status of the order (e.g., "PAID"). - **placedAt** (string) - Required - The timestamp when the order was placed (ISO 8601 format). - **shippingCost** (string) - Required - The cost of shipping. - **shippingCostCurrency** (string) - Required - The currency of the shipping cost. - **shippingMethod** (string) - Required - The shipping method used. - **subtotalPrice** (string) - Required - The subtotal price of the order. - **totalPrice** (string) - Required - The total price of the order. - **totalTax** (string) - Required - The total tax applied to the order. - **weight** (string) - Required - The total weight of the order. - **weightUnit** (string) - Required - The unit of weight (e.g., "lb"). - **fromAddress** (object) - Required - The sender's address details. - **name** (string) - Required - Sender's name. - **company** (string) - Required - Sender's company name. - **street1** (string) - Required - Sender's street address line 1. - **street3** (string) - Optional - Sender's street address line 3. - **streetNo** (string) - Optional - Sender's street number. - **city** (string) - Required - Sender's city. - **state** (string) - Required - Sender's state/province. - **zip** (string) - Required - Sender's zip/postal code. - **country** (string) - Required - Sender's country code (e.g., "US"). - **phone** (string) - Optional - Sender's phone number. - **email** (string) - Optional - Sender's email address. - **isResidential** (boolean) - Optional - Indicates if the address is residential. - **metadata** (string) - Optional - Any metadata associated with the address. - **validate** (boolean) - Optional - Whether to validate the address. - **toAddress** (object) - Required - The recipient's address details. - **name** (string) - Required - Recipient's name. - **company** (string) - Required - Recipient's company name. - **street1** (string) - Required - Recipient's street address line 1. - **street3** (string) - Optional - Recipient's street address line 3. - **streetNo** (string) - Optional - Recipient's street number. - **city** (string) - Required - Recipient's city. - **state** (string) - Required - Recipient's state/province. - **zip** (string) - Required - Recipient's zip/postal code. - **country** (string) - Required - Recipient's country code (e.g., "US"). - **phone** (string) - Optional - Recipient's phone number. - **email** (string) - Optional - Recipient's email address. - **isResidential** (boolean) - Optional - Indicates if the address is residential. - **metadata** (string) - Optional - Any metadata associated with the address. - **validate** (boolean) - Optional - Whether to validate the address. - **lineItems** (array) - Required - An array of line items in the order. - **currency** (string) - Required - The currency of the line item. - **manufactureCountry** (string) - Optional - The country of manufacture. - **maxDeliveryTime** (Date) - Optional - The maximum delivery time. - **maxShipTime** (Date) - Optional - The maximum ship time. - **quantity** (integer) - Required - The quantity of the item. - **sku** (string) - Required - The Stock Keeping Unit of the item. - **title** (string) - Required - The title of the item. - **totalPrice** (string) - Required - The total price for this line item. - **variantTitle** (string) - Optional - The variant title of the item. - **weight** (string) - Required - The weight of the item. - **weightUnit** (string) - Required - The unit of weight for the item. ### Request Example ```json { "currency": "USD", "notes": "This customer is a VIP", "orderNumber": "#1068", "orderStatus": "PAID", "placedAt": "2016-09-23T01:28:12Z", "shippingCost": "12.83", "shippingCostCurrency": "USD", "shippingMethod": "USPS First Class Package", "subtotalPrice": "12.1", "totalPrice": "24.93", "totalTax": "0.0", "weight": "0.4", "weightUnit": "lb", "fromAddress": { "name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "streetNo": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "isResidential": true, "metadata": "Customer ID 123456", "validate": true }, "toAddress": { "name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "streetNo": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "isResidential": true, "metadata": "Customer ID 123456", "validate": true }, "lineItems": [ { "currency": "USD", "manufactureCountry": "US", "maxDeliveryTime": "2016-07-23T00:00:00Z", "maxShipTime": "2016-07-23T00:00:00Z", "quantity": 20, "sku": "HM-123", "title": "Hippo Magazines", "totalPrice": "12.1", "variantTitle": "June Edition", "weight": "0.4", "weightUnit": "lb" } ] } ``` ### Response #### Success Response (200) (Response structure not explicitly defined in source, but typically includes order details upon successful creation.) #### Response Example (Response example not explicitly defined in source.) ``` -------------------------------- ### Retrieve a Shippo Account (Python) Source: https://docs.goshippo.com/api-reference/shippo-accounts/retrieve-a-shippo-account Use the Python SDK to get a Shippo Account by its ID. Ensure you have the SDK installed and your API token configured. ```python import shippo s = shippo.Shippo( api_key_header='ShippoToken ', shippo_api_version='2018-02-08', ) res = s.shippo_accounts.get(shippo_account_id='') if res is not None: # handle response pass ``` -------------------------------- ### Create Manifest - C# Source: https://docs.goshippo.com/api-reference/manifests/create-a-new-manifest This C# example shows how to create a manifest using the Shippo SDK. It initializes the SDK with your API token and version, then calls the CreateAsync method with a populated ManifestCreateRequest object. ```csharp using Shippo; using Shippo.Models.Components; using System.Collections.Generic; var sdk = new ShippoSDK( apiKeyHeader: "ShippoToken ", shippoApiVersion: "2018-02-08" ); var res = await sdk.Manifests.CreateAsync( manifestCreateRequest: new ManifestCreateRequest() { CarrierAccount = "adcfdddf8ec64b84ad22772bce3ea37a", ShipmentDate = "2014-05-16T23:59:59Z", Transactions = new List() { "adcfdddf8ec64b84ad22772bce3ea37a", }, AddressFrom = ManifestCreateRequestAddressFrom.CreateAddressCreateRequest( new AddressCreateRequest() { Name = "Shwan Ippotle", Company = "Shippo", Street1 = "215 Clayton St.", Street3 = "", StreetNo = "", City = "San Francisco", State = "CA", Zip = "94117", Country = "US", Phone = "+1 555 341 9393", Email = "shippotle@shippo.com", IsResidential = true, Metadata = "Customer ID 123456", Validate = true, } ), }, shippoApiVersion: "2018-02-08" ); // handle response ``` -------------------------------- ### Install Shippo Node.js SDK Source: https://docs.goshippo.com/docs/Guides_general/ClientLibraries Install the Node.js client library via npm. The source code is available on GitHub. Supported runtimes are listed in the repository. ```javascript npm install shippo ``` -------------------------------- ### Get Tracking Status with Python Source: https://docs.goshippo.com/api-reference/tracking-status/get-a-tracking-status Retrieve shipment tracking status using the Shippo Python library. Ensure you have the library installed and replace `` with your token. ```python import shippo s = shippo.Shippo( api_key_header='ShippoToken ', shippo_api_version='2018-02-08', ) res = s.tracking_status.get(tracking_number='', carrier='') if res is not None: # handle response pass ``` -------------------------------- ### List All Webhooks - Java Source: https://docs.goshippo.com/api-reference/webhooks/list-all-webhooks This Java example demonstrates how to list all webhooks using the Shippo SDK for Java. Initialize the SDK with your API token and desired API version. ```java package hello.world; import com.goshippo.shippo_sdk.Shippo; import com.goshippo.shippo_sdk.models.operations.ListWebhooksResponse; import java.lang.Exception; public class Application { public static void main(String[] args) throws Exception { Shippo sdk = Shippo.builder() .apiKeyHeader("ShippoToken ") .shippoApiVersion("2018-02-08") .build(); ```