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.
Name | Type | Nullable? | Description |
---|---|---|---|
id | string | The marketplace's unique ID for the sales order. This string must not contain newline characters. | |
identifiers | Your own identifiers for this sales order. | ||
orderNumber | string | The customer facing identifier of the sales order. | |
importedDate | The date that the order was imported. |
Return Value
acknowledgedSalesOrder[]
Name | Type | Required? | Description |
---|---|---|---|
id | string | ✔ | The marketplace's unique ID for the sales order. This string must not contain newline characters. |
identifiers | Your own identifiers for this sales order. | ||
succeeded | boolean | ✔ | Indicate whether the sales order's import was successfully processed. |
failureReason | string | 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 });}