Transaction Object

Every method in a ShipEngine Connect Order 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.

Your Order App should use the transaction.session.auth.accessToken property to obtain the OAuth 2.0 access token required for making calls to your backend API on behalf of the user.

Properties

This table lists the properties of a transaction object and identifies those properties that are nullable.

NameTypeNullable?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.

sessionobject

The application's session data.

session.authobject

An object representing authorization data.

session.auth.accessTokenstring

The access token populated by the authorization process. The value will only be populated by apps that use OAuth 2.0.

Examples

transaction:
{
id: "6ad41b24-62a8-4e17-9751-a28d9688e277",
session: {
auth: {
accessToken: "eyJzdWIiOiJ1c2Vycy9Uek1Vb2NNRjRwIiwibmFtZSI6IlJvYmVydCBUb2tlbiBNYW4iLCJzY29wZSI6InNlbGYgZ3JvdXBzL2FkbWlucyIsImV4cCI6IjEzMDA4MTkzODAifQ"
}
}
}