Skip to content

Latest commit

 

History

History
141 lines (92 loc) · 5.66 KB

File metadata and controls

141 lines (92 loc) · 5.66 KB

Transactions

(transactions)

Overview

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.

Available Operations

  • list - List all shipping labels
  • create - Create a shipping label
  • get - Retrieve a shipping label

list

Returns a list of all transaction objects.

Example Usage

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

Parameters

Parameter Type Required Description
request operations.ListTransactionsRequest ✔️ The request object to use for the request.

Response

components.TransactionPaginatedList

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

create

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.

Example Usage

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

Parameters

Parameter Type Required Description
request operations.CreateTransactionRequestBody ✔️ The request object to use for the request.

Response

components.Transaction

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

get

Returns an existing transaction using an object ID.

Example Usage

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

Parameters

Parameter Type Required Description
transaction_id str ✔️ Object ID of the transaction to update

Response

components.Transaction

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*