Skip to main content

ERP Integration

Askås API provides building opportunities for ERP- integrations: order retrieval, order status updates, and shipping information. This page explains the recommended integration pattern for orders and highlights the areas that still need Askås confirmation.

What is supported today

Order retrieval

  • Use orderConnection to fetch orders.
  • You can filter orders using OrdersFilter with createdFrom, createdTo, and statusId.

Order status

  • Each order exposes Order.status.
  • OrdersFilter.statusId lets you fetch only orders with a specific status.
  • Standard status ids are covered in the summary section below.

Tracking and shipment data

  • Order.shippingDetails is available on the Order object.
  • Shipping.shipments contains one or more Shipment records.
  • Each Shipment can provide:
    • trackingNumber
    • trackingLink
    • deliveredAt
    • erpReference — a value that can be set on the shipping method in Askås admin.
  • order->fees can also contain a reference to the Askås ID of the shipping method when mapping is handled on the business systems side.

Order updates and shipment updates

  • Order updates are performed through batchUpdateOrders.
  • BatchOrderInput supports:
    • id (order id)
    • status via BatchOrderStatusInput (id)
    • shipments via BatchOrderShipmentInput
  • This means ERP can update order status and attach shipment/tracking information.

Standard order statuses

Askås has standard status values for common order flow handling:

  • 0 = New order
  • 1 = Received by ERP
  • 6 = Sent order
  • 99 = Canceled order

When an order moves to 6, Askås usually activates payment. When an order moves to 99, the payment is canceled. Payment handling may depend on the payment provider.

Note: Other status values are shop-specific. Merchants can configure custom statuses based on their own store setup and workflow.

Incremental order fetch

There are two common approaches:

  1. Fetch new orders by status

    • Fetch orders with statusId: 0.
    • After processing, update orders to statusId: 1 so Askås knows they have been imported.
  2. Fetch based on timestamps

    • Save the timestamp of the last successful sync.
    • Use createdFrom with that timestamp in the next run.

Example: fetch orders with shipping and status

query getOrders($createdFrom: DateTime, $statusId: Int) {
orderConnection(first: 50, filter: {createdFrom: $createdFrom, statusId: $statusId}) {
edges {
node {
id
createdAt
status {
id
name {
value
}
}
shippingAddress {
firstName
lastName
streetAddress
postalCode
city
}
shippingDetails {
serviceCode
deliveryAt
shipments {
trackingNumber
trackingLink
deliveredAt
}
}
}
}
pageInfo {
endCursor
}
totalCount
}
}

Example: update order status and shipment tracking

mutation updateOrder($input: [BatchOrderInput!]!) {
batchUpdateOrders(input: $input) {
id
status
}
}

Example variables:

{
"input": [
{
"id": 23444,
"status": { "id": 6 },
"shipments": [
{
"trackingNumber": "123456789"
}
]
}
]
}

Example: update stock balance for multiple products

For ERP inventory sync, you can update only the stock balance for several products in the same batch request.

Askås decrements stock when an order is placed, so there is normally no need to synchronize every stock change back on each order. Use this batch update for periodic inventory reconciliation, or corrections rather than per-order delta sync.

mutation updateProductStock {
batchUpdateProducts(
input: [
{id: "prod123", stock: 10},
{id: "prod124", stock: 5}
]
) {
id
status
}
}

Example variables:

{
"input": [
{"id": "prod123", "stock": 10},
{"id": "prod124", "stock": 5}
]
}