mirror of
https://github.com/LukeHagar/speakeasy-playground.git
synced 2025-12-09 20:57:44 +00:00
Orders
(orders)
Overview
An order is a request from a customer to purchase goods from a merchant. Use the orders object to load orders from your system to the Shippo dashboard. You can use the orders object to create, retrieve, list, and manage orders programmatically. You can also retrieve shipping rates, purchase labels, and track shipments for each order.
Line Item
Line Items, and their corresponding abstract Products and Variants, might be exposed as a separate resource
in the future. Currently it's a nested object within the order resource.
Available Operations
- list_orders - List all orders
- create_order - Create a new order
- get_order - Retrieve an order
list_orders
Returns a list of all order objects.
Example Usage
import shippo
s = shippo.Shippo(
api_key_header="<YOUR_API_KEY_HERE>",
)
res = s.orders.list_orders(page=1, results=25, shippo_api_version='<value>')
if res.order_list_wrapper is not None:
# handle response
pass
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page |
Optional[int] | ➖ | The page number you want to select |
results |
Optional[int] | ➖ | The number of results to return per page (max 100) |
shippo_api_version |
Optional[str] | ➖ | String used to pick a non-default API version to use |
Response
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4x-5xx | / |
create_order
Creates a new order object.
Example Usage
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header="<YOUR_API_KEY_HERE>",
)
res = s.orders.create_order(shippo_api_version='<value>', order_create_request=components.OrderCreateRequest(
placed_at='2016-09-23T01:28:12Z',
to_address=components.AddressCreateRequest(
country='US',
name='Shwan Ippotle',
company='Shippo',
street1='215 Clayton St.',
street3='',
street_no='',
city='San Francisco',
state='CA',
zip='94117',
phone='+1 555 341 9393',
email='shippotle@shippo.com',
is_residential=True,
metadata='Customer ID 123456',
validate=True,
),
currency='USD',
notes='This customer is a VIP',
order_number='#1068',
order_status=components.OrderCreateRequestOrderStatus.PAID,
shipping_cost='12.83',
shipping_cost_currency='USD',
shipping_method='USPS First Class Package',
subtotal_price='12.1',
total_price='24.93',
total_tax='0.0',
weight='0.4',
weight_unit=components.WeightUnit.LB,
))
if res.order is not None:
# handle response
pass
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
shippo_api_version |
Optional[str] | ➖ | String used to pick a non-default API version to use |
order_create_request |
Optional[components.OrderCreateRequest] | ➖ | Order details. |
Response
operations.CreateOrderResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4x-5xx | / |
get_order
Retrieves an existing order using an object ID.
Example Usage
import shippo
s = shippo.Shippo(
api_key_header="<YOUR_API_KEY_HERE>",
)
res = s.orders.get_order(order_id='<value>', shippo_api_version='<value>')
if res.order is not None:
# handle response
pass
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
order_id |
str | ✔️ | Object ID of the order |
shippo_api_version |
Optional[str] | ➖ | String used to pick a non-default API version to use |
Response
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4x-5xx | / |