Transaction Object

Every method in a ShipEngine Connect Carrier App receives a transaction object as the first parameter. This object contains useful information about the method invocation, such as a unique transactionID, and includes session state such as authentication credentials.

Any of your methods may modify the session property of a transaction object. For example, your connect method can set authentication information in the session property so that when the transaction object is passed to other methods, they can access it and use it when calling the backend API or service. Likewise, if a method finds the authentication information to be invalid or expired, they may update the session property with a new value so that subsequent method calls have valid authentication information available.

Properties

This table lists the properties of a transaction object and identifies those properties that are required. The nullable column indicates which properties may be null when the object is provided as an argument to one of your methods, and the required column indicates which properties are required when the object is returned from one of your methods

NameTypeRequired?Nullable?Description
id

UUID

Uniquely identifies the current transaction. If the transaction is retried, then this id will remain the same. You can use this to detect and prevent duplicate operations.

languagestring

Represents the desired language of the request. This property should be a string that contains a BCP 47 language tag (e.g. en-US, en-GB).

sessionobject

The application's session data. Any method may update the session data, such as renewing a session token or updating a timestamp. Must be JSON serializable.

Example

Here's an example transaction object:

{
id: "6ad41b24-62a8-4e17-9751-a28d9688e277",
language: "en-US",
session: {
id: "sess_184849191484716854941017",
accountNumber: "10004583",
expires: "2025-07-16T12:45:15.000Z",
lang: "en-US",
}
}