(transactions)
A transaction is the purchase of a shipping label from a shipping provider for a specific service. You can print purchased labels and used them to ship a parcel with a carrier, such as USPS or FedEx.
Returns a list of all transaction objects.
import shippo
from shippo.models import components, operations
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
res = s.transactions.list(request=operations.ListTransactionsRequest(
object_status=components.TransactionStatusEnum.SUCCESS,
tracking_status=components.TrackingStatusEnum.DELIVERED,
))
if res is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListTransactionsRequest | ✔️ | The request object to use for the request. |
components.TransactionPaginatedList
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Creates a new transaction object and purchases the shipping label using a rate object that has previously been created.
OR
Creates a new transaction object and purchases the shipping label instantly using shipment details, an existing carrier account, and an existing service level token.
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
res = s.transactions.create(request=components.TransactionCreateRequest(
rate='ec9f0d3adc9441449c85d315f0997fd5',
async_=False,
label_file_type=components.LabelFileTypeEnum.PDF_4X6,
metadata='Order ID #12345',
order='adcfdddf8ec64b84ad22772bce3ea37a',
))
if res is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateTransactionRequestBody | ✔️ | The request object to use for the request. |
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Returns an existing transaction using an object ID.
import shippo
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
res = s.transactions.get(transaction_id='<value>')
if res is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
transaction_id |
str | ✔️ | Object ID of the transaction to update |
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |