(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.
- List - List all shipping labels
- Create - Create a shipping label
- Get - Retrieve a shipping label
Returns a list of all transaction objects.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
ListTransactionsRequest req = new ListTransactionsRequest() {
ObjectStatus = Shippo.Models.Components.TransactionStatusEnum.Success,
TrackingStatus = Shippo.Models.Components.TrackingStatusEnum.Delivered,
};
var res = await sdk.Transactions.ListAsync(req);
// handle response
TransactionPaginatedList
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
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.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Transactions.CreateAsync(
requestBody: CreateTransactionRequestBody.CreateTransactionCreateRequest(
new TransactionCreateRequest() {
Async = false,
LabelFileType = Shippo.Models.Components.LabelFileTypeEnum.Pdf4x6,
Metadata = "Order ID #12345",
Rate = "ec9f0d3adc9441449c85d315f0997fd5",
Order = "adcfdddf8ec64b84ad22772bce3ea37a",
}
),
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
RequestBody |
CreateTransactionRequestBody |
✔️ |
Examples. |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
Transaction
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Returns an existing transaction using an object ID.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Transactions.GetAsync(
transactionId: "<id>",
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
TransactionId |
string |
✔️ |
Object ID of the transaction to update |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
Transaction
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |