For the complete documentation index, see llms.txt. This page is also available as Markdown.

Order Create

This tutorial explains how the Order Create process works for the N11 integration in the Marketplace Dashboard: which orders are picked up, which requests are made to N11 and Omnitron (with example data), how the end-to-end process works, and how to read the error codes it produces.

For channel-level setup (Feature Flags, Order Start Date, Cargo Company Mapping, Use Neighborhood, Send Shipping Info, etc.), see N11 Marketplace Setup Configurations tutorial.

What is Order Create?

Order Create pulls orders from N11 into Omnitron that fall within a specified start date and end date range and match a given order status. On the Logs screen, this process appears under the flow name Order Create.

When Does It Run?

  • Controlled by the get_orders feature flag in the channel settings. When active, it runs automatically:

    • Every 5 minutes, requesting orders in the Picking status only, within a rolling last 12 hours window (bounded below by the channel's Order Start Date, which mainly matters for the very first run).

    • Every night at 03:00, an additional catch-up run requests the Picking status again, but with the date window widened to the last 15 days, to pick up anything the 5-minute runs might have missed.

  • Users can also manually trigger this flow from the Dashboard — either for one of three statuses (Picking, Shipped, or Delivered), or by targeting a specific order directly via its order number or package number, bypassing status/date filtering entirely.

  • Before activating this flag, Order Start Date, Use Neighborhood, Send Shipping Info, Use Channel ID In Address Mapping, Get Discount Amount, Order Number Format, OMS Enabled, ERP Code and Cargo Company Mapping must be configured — see N11 Marketplace Setup Configurations.

Which Orders Are Eligible?

An order is picked up only if it:

  • Has a status matching the run — Picking on both the 5‑minute schedule and the nightly catch-up run, or Picking / Shipped / Delivered when a user triggers the flow manually by status.

  • Falls within the date window: the last 12 hours on the regular 5-minute schedule, or the last 15 days on the nightly catch-up run — both bounded below by the channel's Order Start Date.

  • Unless the manual trigger targets a specific order number or package number — in that case the order is fetched directly, regardless of its status or date.

  • Has not already been imported into Omnitron — the flow checks this before doing any other work (see Skipping Already-Imported Orders) and simply skips the package if it has.

When an order is imported, its order and order item are created in Omnitron directly with status 400 (approved).

Fetching Orders from N11

Orders (called shipment packages on N11's side) are fetched with:

When a manual trigger targets a specific order instead, startDate / endDate / status are replaced with a single filter:

The automatic runs (both the 5-minute run and the nightly catch-up run) always send status=Picking explicitly; a manual trigger from the Dashboard sends whichever of Picking, Shipped, or Delivered the user selected — or, if the trigger targets a specific order, the order number or package number query above instead (order number takes priority if both are given). If none of these is supplied at all, the flow falls back to status=Picking internally.

The response is paginated (totalPages / totalOrderCount); the flow keeps requesting the next page until every page for that run has been retrieved and merged into a single list.

Skipping Already-Imported Orders

For every package, the flow first makes sure it hasn't been imported before:

If no order is found by number, it also checks by the remote package ID, in case the order exists under a different number:

If either call finds a match, the package is skipped entirely — nothing else in this tutorial runs for it.

The remote-package-ID check is what keeps this safe even if Order Number Format is changed later: the constructed number for a previously imported order would no longer match under the new format, but the package ID lookup still finds it, so the order is not re-imported as a duplicate.

Checking for Existing Cancellation/Refund Plans

Before going any further, the flow re-checks the package's current state directly on N11 (GET {mp_host}/rest/delivery/v1/shipmentPackages?orderNumber={orderNumber}) together with Omnitron's own cancellation_plans for that order — internally, this step is called CancelRefundControl. It guards against creating (or re-processing) an order that already has a cancellation or refund plan in progress, which is otherwise handled by the separate Cancel/Refund Orders flow.

Resolving the Customer

The buyer is matched (or created) in Omnitron using N11's customerId as the channel code:

If no customer is found, one is created:

first_name / last_name are split off the first full name available, in this order of preference: N11's own customerfullName field, then shippingAddress.fullName, then billingAddress.fullName.

Resolving Shipping & Billing Addresses

Each address's city, township, district, and neighborhood — plus countryCode on the billing side — are matched against Omnitron's own country / city / township / district records (using each record's marketplace mapping first, then falling back to a name match). If a value can't be matched, an error report is created in Omnitron for that model (CreateErrorReport) and the order stops with the corresponding error code (see below).

Once resolved, the address is created in Omnitron — or reused if an identical one (matched by a hash of its contents, hash_data) already exists:

A few behaviors worth noting:

  • Neighborhood is only sent if Use Neighborhood is active in the channel settings; otherwise the district (mahalle) field is left empty on the Omnitron address.

  • Billing address for a corporate invoice (N11's invoiceType = "2"): company_name, tax_office, and tax_no are filled from N11's customerfullName / taxOffice / taxId, and e_bill_taxpayer is set to true.

  • Micro-export orders (micro: true): the billing address is created without district / township, regardless of the Use Neighborhood setting.

Resolving the Cargo Company

N11's numeric shipmentCompanyId (e.g. 344) is translated to an internal carrier slug (e.g. yurtici) using a fixed built-in table (mng, aras, ups, surat, horoz, ptt, etc.), and that slug is then looked up in the channel's own Cargo Company Mapping setting to get the Omnitron cargo_company ID:

If N11's shipmentCompanyId doesn't resolve to a known slug, or the slug isn't present in Cargo Company Mapping, the mapping's mandatory "default" entry is used instead.

Enriching Order Items from Omnitron

For every order line, the product is resolved in two steps:

  1. Omnitron is first queried for an existing Integration Action linking N11's stockCode to a product, using it as the remote ID:

  1. If no such Integration Action is found yet, the product itself is looked up using the RemoteId Schema mapped attribute (or its sku if no mapping is configured), and a new Integration Action is created linking it to this stockCode so future orders skip straight to step 1:

Then, for the matched product, its stock and price records are fetched:

If the product, its stock, or its price can't be found, the order stops with error code 2018 (see below), and the specific missing remote IDs are included in the log message.

Building & Sending the Order to Omnitron

Once the customer, addresses, cargo company, and every order item have been resolved, the order is assembled and sent as a single request:

If Get Discount Amount is active in the channel settings, discount_amount is also populated on the order and each order item from N11's totalSellerDiscountPrice. If OMS Enabled is active and Send Shipping Info is not, tracking_number is populated on the order (and, when applicable, on each item) from N11's cargoTrackingNumber — otherwise the tracking number is left for the brand's own shipping process to set. For micro-export orders, extra_field on the order additionally includes etgbNo, etgbDate, and hsCode from N11.

Order and Order Item extra_field Mapping

Omnitron field
Source
Notes

order.extra_field.id

N11 id

The N11 shipment package ID — also used later as the order's remote_id for duplicate checks.

order.extra_field.tracking_number

N11 cargoTrackingNumber

order.extra_field.orderNumber

N11 orderNumber

order.extra_field.micro

N11 micro

order.extra_field.etgbNo / etgbDate / hsCode

N11 etgbNo / etgbDate / hsCode

Only present when micro is true.

order_item.extra_field.id

N11 orderLineId

order_item.extra_field.status

N11 orderItemLineItemStatusName

order_item.extra_field.campaign_number / tracking_number

N11 cargoTrackingNumber

Same tracking number, kept under both keys.

order_item.extra_field.price_extra_field

Omnitron product price record's extra_field

Copied through as-is, not derived from N11.

order_item.extra_field.stock_extra_field

Omnitron product stock record's extra_field

Copied through as-is, not derived from N11.

How the Process Works — Summary

  1. Orders matching the run's status (Picking on the automatic runs, or Picking / Shipped / Delivered on a manual trigger) and the configured date window are fetched from N11, page by page — or, when a manual trigger targets a specific order number or package number instead, that single order is fetched directly.

  2. Each package is checked against Omnitron by order number and by remote ID — if it already exists, it's skipped.

  3. Any existing cancellation/refund plan for the package is checked.

  4. The customer is resolved (matched by customerId, or created).

  5. The shipping and billing addresses are resolved — country, city, township, and district are matched or reported as errors — and created or reused in Omnitron.

  6. The cargo company is resolved via the built-in N11 carrier table and the channel's Cargo Company Mapping.

  7. Each order item's product, stock, and price are fetched from Omnitron, and a missing Integration Action is created for the product if needed.

  8. The order and its items are assembled — including all extra_field values — and sent to Omnitron in a single request.

  9. The outcome is written back and becomes visible on the Logs screen.

Monitoring

  1. From the left menu, go to Sales Channels > N11 > Marketplace Operations > Logs.

  2. Filter by flow name Order Create.

  3. Use the Order Number or Execution ID filters to locate a specific order.

Flow Trigger

Manual runs described in When Does It Run? are started from the Trigger screen (Sales Channels > N11 > Marketplace Operations > Trigger), by clicking Run next to the Order Create flow. In the popup form, select a status (Picking, Shipped, or Delivered), or fill in an order number / package number to fetch that single order directly instead.

See the Flow Trigger tutorial for the general trigger screen walkthrough (single trigger vs. CSV trigger).

Error Codes and Explanations

Code
Meaning

1001

The order's basic info (order number, package ID, micro flag) could not be extracted from N11's response.

1002

An error occurred while resolving (matching or creating) the customer in Omnitron.

1003

The order's city could not be resolved in Omnitron.

1004

The order's township (ilçe) could not be resolved in Omnitron.

1005

An error occurred while resolving or creating the shipping address.

1006

An error occurred while resolving or creating the billing address.

1007

An error occurred while resolving the cargo company.

1008

The order was rejected by Omnitron's create_orders endpoint.

1021

The order's district (mahalle) could not be resolved in Omnitron.

1026

The order's country could not be resolved in Omnitron.

1028

An error occurred while checking whether the order already exists in Omnitron.

1030

An error occurred while checking the package's cancellation/refund state.

2018

One or more order items could not be enriched — the product, its stock, or its price was not found in Omnitron for the given stockCode. The log message lists the specific remote IDs that were not found.

Address-resolution failures (1003, 1004, 1021, 1026) also create an entry under the corresponding model in Omnitron's mapping error reports, so the missing country/city/township/district mapping can be added without waiting for the next retry.

These entries can be reviewed from Omnitron's left menu under Integration > Mapping Error Logs, where the failed address mappings can be inspected and, if applicable, resolved directly with the Resolve action to create the missing mapping automatically. The mapping can also be created manually ahead of time from Integration > Address Mapping.

  • get_orders feature flag — enables/disables the automatic 5-minute Picking run and the nightly 03:00 Picking catch-up run (15 days back).

  • Order Start Date — the earliest date this flow will fetch orders from.

  • Cargo Company Mapping — required; its "default" entry is used whenever N11's carrier can't be mapped to a more specific one.

  • Use Neighborhood — whether the neighborhood is included when creating addresses.

  • Use Channel ID In Address Mapping — scopes address mapping/search to this channel.

  • Get Discount Amount — whether discount_amount is populated from N11 on the order and its items.

  • Order Number Format — customizes the Omnitron order number; defaults to {orderNumber}-{id}.

  • OMS Enabled / Send Shipping Info — control whether the tracking number is populated by this flow or left to the brand's own shipping process.

  • ERP Code — not used by this flow directly; it can be used to distinguish the relevant sales channel in ERP integration.

See N11 Marketplace Setup Configurations for how to configure all of the above.

Last updated

Was this helpful?