acknowledgeOrders()

This method is called when a sales order is imported into one of our e-commerce applications.

Syntax

module.exports = async function acknowledgeOrders(transaction, notifications[] {
// Your code here
}
import { Transaction, SalesOrderNotification, AcknowledgeSalesOrder} from "@shipengine/connect-sdk";
export default async function acknowledgeOrders(
transaction: Transaction,
notifications: SalesOrderNotifications
): Promise<void> {
// Your code here
}

Parameters

transaction

A transaction object containing information about the transaction and session state.

notifications[]

An array of notifications regarding sales orders that have been imported.

NameTypeNullable?Description
idstring

The marketplace's unique ID for the sales order. This string must not contain newline characters.

identifiers

identifiers object

Your own identifiers for this sales order.

orderNumberstring

The customer facing identifier of the sales order.

importedDate

date/time object

The date that the order was imported.

Return Value

acknowledgedSalesOrder[]

NameTypeRequired?Description
idstring

The marketplace's unique ID for the sales order. This string must not contain newline characters.

identifiers

identifiers object

Your own identifiers for this sales order.

succeededboolean

Indicate whether the sales order's import was successfully processed.

failureReasonstring

Additional context for why the acknowledgement failed.

Example

async function acknowledgeSalesOrder(transaction, notifications) {
// STEP 1: Validation
// Add any desired validation here
// STEP 2: Create the data that the order source's API expects
const data = {
operation: "ack_order",
session_id: transaction.session.id,
shipment_id: shipment.trackingNumber
};
// STEP 3: Call the order source's API
await apiClient.request({ data });
}
export default async function shipmentCreated(
transaction: Transaction<Session>,
notifications: SalesOrderNotification,
): Promise<void> {
// STEP 1: Validation
// Add any desired validation here
// STEP 2: Create the data that the order source's API expects
const data = {
operation: "ack_order",
session_id: transaction.session.id,
order_number: shipment.orderNumber
};
// STEP 3: Call the order source's API
await apiClient.request({ data });
}