Postman collection
Shipping Write

pixiUpdateInvoicePackage

Updates tracking IDs, label URLs and provider messages of an invoice package and writes the tracking IDs to the related invoice.

Writes the result of a shipping provider (tracking number, label URLs, provider messages) to a package of an invoice (pixi.InvoicePackage) and to the invoice itself (dbo.Invoices).

Steps:

  1. All string parameters that are passed as empty strings are treated as NULL (= not supplied).
  2. The package PackageId must exist, otherwise a 400 response is returned.
  3. If InvoiceKey is supplied, it must match the invoice of the package, otherwise a 400 response is returned. If it is omitted, the invoice of the package is used.
  4. Package update: TrackingID, ReturnTrackingId, ExternalShipmentId, MessageFromProvider and MessageFromProviderDetail are overwritten only with supplied values; omitted values keep the stored data. ShippingLabelUrl and ReturnLabelUrl take the new value or keep the current one. For packages of a shipping vendor with external label functionality (functionality version 3) that were shipped via a toolbox station, ShippingLabelUrl is set to NO URL FROM PROVIDER if no URL exists at all. RecordModifiedOn and RecordModifiedByUserId (user API) are set.
  5. Invoice update:
    • ShipmentTrackingID: if empty, it is set to TrackingId; otherwise TrackingId is appended with ; unless the existing value already contains it.
    • retTrackID / retTrackIDhist: if retTrackID is empty, retTrackID becomes ReturnTrackingId and the history is set to ReturnTrackingId;. Otherwise, if the new ID is not yet contained in retTrackID, it is appended to the history and retTrackID is replaced.
    • UpdateDate and UpdateEmp (TrackingID API Import) are set.
  6. If ResetClientNotifiedFlag = 1, the latest AUS (shipped) order history entry of every order line on the invoice is reset to ClientNotified = 'N', so the order is exported again with the tracking ID.
  7. A row with Response = 200 OK is returned and the transaction is committed.
  8. After the commit, MQ events are published: PackageLabelSaved (only for external label packages shipped via toolbox station, with flags whether the shipping or return label URL changed) and always InvoiceChanged with parameter SetTrackingId.

Notes

  • Runs in its own transaction (or a savepoint if a transaction is already open). An exclusive application lock PixiInvoicePackage (timeout 30 s) serializes the call with other package updates; if the lock cannot be acquired the update still runs.
  • Deadlocks (error 1205) are retried up to 5 times with a 5 ms delay. Other errors are logged via log.InsertError and answered with 500 Internal Server Error. In rare error situations after the 200 OK row (e.g. during commit or event publishing), the caller may receive more than one Response result set.
  • The duplicate check for tracking IDs is a substring LIKE test: an ID that is part of an existing ID (e.g. 123 in 12345) is not appended to the invoice, and % or _ in IDs act as wildcards.
  • InvoicePackage.TrackingID is overwritten, whereas Invoices.ShipmentTrackingID collects all IDs separated by ;.
  • If the invoice has no return tracking ID yet, retTrackIDhist is replaced (not appended) by the new ID.
  • CONTEXT_INFO is set to 0x11111 during the invoice update, presumably to influence triggers on dbo.Invoices.
  • Lookups use NOLOCK.
  • MQ events are only sent if the setting pixiMQ_Enabled is active and the events are configured and enabled in EventConfiguration.

Tables used

InvoicePackage · Write ShipVendor · Read ShipVendorFunctionality · Read Invoices · Write OrderHistory · Write Invlines · Read UCS_USERS · Read
SQL object:
dbo.pipiUpdateInvoicePackage
Updated at 2026-10-30