fabric’s Orders service simplifies complex order management and fulfillment processes after an order is created either by using any checkout service or at the Point of Sale (POS).

With fabric’s Orders service, merchants can:

  • Create a unified commerce experience by importing all orders in real time to a single application.
  • Cancel, return, and exchange orders.
  • Handle tasks such as invoicing, shipment tracking, backorders, and other use cases.
  • Use the endpoints to create orders, initiate post-order process workflows, and manage order-related data, such as setting the estimated delivery date and ship-by date. Additionally, merchants can set fulfillment location information to view what facility orders were allocated for the fulfillment.

Workflow

The following provides a basic workflow of fabric’s Orders service for the orders created using a checkout service:

  1. Merchants create an Order and upload details to fabric’s Orders service after shoppers complete the payment process at the checkout stage.
  2. fabric Orders sends a notification for different order updates, using the Notification APIs, to shoppers and merchants.
  3. fabric Orders allocates the order, using allocation APIs, to the shopper’s nearest warehouse or facility for inventory confirmation, and shipping of the product.
  4. Order is then picked, packed, and shipped.
  5. Merchant and shopper are notified of the delivery being shipped.
  6. The order is completed when it reaches the shopper’s delivery address.

Set up Order Tracking for an Order Created Using a Checkout Service

After an order is created, for the order to drop to the warehouse, merchants must set up webhook subscriptions to fabric’s Orders events for better order management.

Step 1: Set up a webhook subscription to OMS events

  1. Use webhook endpoint (POST/v3/oms-webhooks) to set up webhook subscriptions to various order events so that when an order is created or updated, fabric OMS automatically starts the post-order processes, and sends notifications for the subscribed events.
  2. Once an order is allocated to a warehouse, the webhook that you have configured, sends a notification mentioning an allocation ID.

Following is a curl example for subscribing to allocation events:

curl --location --request POST 'https://api.fabric.inc/v3/oms-webhooks' \
--header 'Authorization: Bearer {token}' \
--header 'x-site-context: {"account":"63310842f37ee100111e9fe3"}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "target": "https://webhook.site/83834d4c-9736-4cba-b32b-e6b6d75a6683",
    "protocol": "HTTP",
    "source": "ORDER_SERVICE", // This will change based on service to be subscribed
    "apiVersion": "1.0.0",
    "format": "application/json",
    "requestType": "POST",
    "events": [
        "ORDER_CREATE"
        "ORDER_SHIPPED" // List of events to subscribe
    ]
}'

To subscribe to any other events of fabric Orders, mention the respective source name and events that you want to subscribe for. For details, see List of Webhook Events.

Step 2: Create an Order and Upload it to fabric OMS

Use the POST/v3/orders endpoint to create an order through any integrated checkout service that you are using.

  • The orderNumber field that’s passed during order creation is a string.
  • For Cash On Delivery (COD) orders, provide paymentMethod as ‘CASH_ON_DELIVERY’, and chargedAmount as ‘0’ under the payment object while creating an order.

Request Sample

{
  "orderNumber": "309019176",
  "orderedAt": "2022-05-12T09:30:31.198Z",
  "adjustmentTotal": 123.45,
  "adjustments": [
    {
      "adjustmentCounter": 1,
      "amount": 2.4,
      "attributes": {
        "number": "XlQZTmFDFtPFGMxJP6oiAqN3vo+qKZ"
      },
      "cancelQuantity": 2,
      "invoiceQuantity": 10,
      "notes": "Any additional info",
      "quantity": 2,
      "reasonCode": "RFC",
      "returnQuantity": 1,
      "subReasonCode": "Late shipping"
    }
  ],
  "cartId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
  "type": "WEB",
  "subtype": "INTERNATIONAL",
  "employeeId": "62272e917b12209e68751d94",
  "retail": {
    "locationNumber": 334,
    "cashierId": "C-123",
    "registerId": "113",
    "transactionId": "328942333412"
  },
  "orderSubtotal": 123.45,
  "orderDiscount": 1.23,
  "feeTotal": 12.34,
  "taxTotal": 12.34,
  "orderTotal": 146.9,
  "currency": "USD",
  "statusCode": "ORDER_CREATED",
  "statusDescription": "Order Created",
  "attributes": {
    "fraudStatus": "FRAUD_PASS",
    "fraudCheckStatus": "UPDATED"
  },
  "fees": [
    {
      "name": "STATE",
      "taxCode": "FR01",
      "rateType": "PERCENTAGE",
      "rate": 10,
      "amount": 34.56,
      "currency": "USD",
      "attributes": {
        "additionalProp1": {},
        "additionalProp2": {},
        "additionalProp3": {}
      },
      "invoicedAmount": 34.56
    }
  ],
  "discounts": [
    {
      "quantity": 2,
      "amount": 2.4,
      "unit": "AMOUNT_OFF",
      "value": 2,
      "promotionId": "HNY2022",
      "promotionCode": "HNY2022",
      "promotionName": "New Year",
      "type": "promotion"
    }
  ],
  "customer": {
    "name": {
      "firstName": "Alex",
      "middleName": "E",
      "lastName": "Doe"
    },
    "email": "[[email protected]](/cdn-cgi/l/email-protection)",
    "phone": {
      "number": "123-456-7890",
      "type": "MOBILE"
    },
    "userId": "62272e917b12209e68751d94",
    "accountId": "62272e917b12209e68751d94",
    "employeeId": "62272e917b12209e68751d94",
    "company": "Demo Inc",
    "address": {
      "name": {
        "firstName": "Alex",
        "middleName": "E",
        "lastName": "Doe"
      },
      "email": "[[email protected]](/cdn-cgi/l/email-protection)",
      "phone": {
        "number": "123-456-7890",
        "type": "MOBILE"
      },
      "addressLine1": "123 Main St.",
      "addressLine2": "Suite 100",
      "addressLine3": "Seventh floor",
      "addressLine4": "Attention: Pat E. Kake",
      "city": "Seattle",
      "region": "WA",
      "postalCode": "98121",
      "countryCode": "US",
      "type": "Home",
      "latitude": 47.6205,
      "longitude": -122.3493
    }
  },
  "payments": [
    {
      "paymentCounter": 1,
      "paidAt": "2022-01-27T16:15:58-05:00",
      "paymentIdentifier": {
        "cardIdentifier": "3456",
        "expirationYear": "2029",
        "expirationMonth": "12",
        "paymentId": "62272e917b12209e68751d94",
        "fabricPaymentReference": "f886c96c-5f65-11ed-9b6a-0242ac120002"
      },
      "paymentProvider": "stripe",
      "paymentToken": {
        "token": "pi_34tr6787rt",
        "paymentType": "VISA"
      },
      "paymentMethod": "CREDIT_CARD",
      "authorizedAmount": 123.2,
      "chargedAmount": 60,
      "currency": "USD",
      "paymentStatus": "Paid",
      "authorizationExpirationDate": "2022-01-27T16:15:58-05:00",
      "billToAddress": {
        "name": {
          "firstName": "Alex",
          "middleName": "E",
          "lastName": "Doe"
        },
        "email": "[[email protected]](/cdn-cgi/l/email-protection)",
        "phone": {
          "number": "123-456-7890",
          "type": "MOBILE"
        },
        "addressLine1": "123 Main St.",
        "addressLine2": "Suite 100",
        "addressLine3": "Seventh floor",
        "addressLine4": "Attention: Pat E. Kake",
        "city": "Seattle",
        "region": "WA",
        "postalCode": "98121",
        "countryCode": "US",
        "type": "Home",
        "latitude": 47.6205,
        "longitude": -122.3493
      },
      "attributes": {
        "referenceId": "4DY41894J2904533S",
        "payerId": "M7AWTK3YK3B46",
        "captureCurrencyCode": "USD"
      }
    }
  ],
  "items": [
    {
      "lineItemId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
      "lineItemNumber": 1,
      "itemId": 1234,
      "sku": "P1234",
      "segment": "P1234",
      "vendorId": "P1234",
      "itemName": "Item",
      "type": "WEB_SHIP",
      "itemSubtype": "Borderfree",
      "orderedQuantity": 60,
      "uom": "EA",
      "shipToId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
      "itemUnitPrice": 10,
      "itemSubtotal": 600,
      "itemFeeTotal": 10,
      "itemDiscountsTotal": 10,
      "itemTaxTotal": 10,
      "itemTotal": 10,
      "currency": "USD",
      "employeeId": "62272e917b12209e68751d94",
      "fees": [
        {
          "name": "STATE",
          "taxCode": "FR01",
          "rateType": "PERCENTAGE",
          "rate": 10,
          "amount": 34.56,
          "currency": "USD",
          "attributes": {
            "additionalProp1": {},
            "additionalProp2": {},
            "additionalProp3": {}
          }
        }
      ],
      "taxCode": "FR01",
      "taxDetails": [
        {
          "name": "STATE",
          "taxCode": "FR01",
          "rateType": "PERCENTAGE",
          "rate": 10,
          "amount": 34.56,
          "currency": "USD",
          "attributes": {
            "additionalProp1": {},
            "additionalProp2": {},
            "additionalProp3": {}
          }
        }
      ],
      "discounts": [
        {
          "quantity": 2,
          "amount": 2.4,
          "unit": "AMOUNT_OFF",
          "value": 2,
          "promotionId": "HNY2022",
          "promotionCode": "HNY2022",
          "promotionName": "New Year",
          "type": "promotion"
        }
      ],
      "attributes": {
        "style": "570223020",
        "colorCode": "001",
        "isDonation": "false"
      },
      "isBackorder": true,
      "isPreorder": true,
      "isDonation": true
    }
  ],
  "shipInfo": [
    {
      "shipToId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
      "taxCode": "FR01",
      "locationNumber": "123",
      "pickups": [
        {
          "name": {
            "firstName": "Alex",
            "middleName": "E",
            "lastName": "Doe"
          },
          "email": "[[email protected]](/cdn-cgi/l/email-protection)",
          "phone": {
            "number": "123-456-7890",
            "type": "MOBILE"
          },
          "pickupType": "PRIMARY"
        }
      ],
      "shipToAddress": {
        "name": {
          "firstName": "Alex",
          "middleName": "E",
          "lastName": "Doe"
        },
        "email": "[[email protected]](/cdn-cgi/l/email-protection)",
        "phone": {
          "number": "123-456-7890",
          "type": "MOBILE"
        },
        "addressLine1": "123 Main St.",
        "addressLine2": "Suite 100",
        "addressLine3": "Seventh floor",
        "addressLine4": "Attention: Pat E. Kake",
        "city": "Seattle",
        "region": "WA",
        "postalCode": "98121",
        "countryCode": "US",
        "type": "Home",
        "latitude": 47.6205,
        "longitude": -122.3493
      },
      "taxDetails": [
        {
          "name": "STATE",
          "taxCode": "FR01",
          "rateType": "PERCENTAGE",
          "rate": 10,
          "amount": 34.56,
          "currency": "USD",
          "attributes": {
            "additionalProp1": {},
            "additionalProp2": {},
            "additionalProp3": {}
          }
        }
      ],
      "shipMethod": "Parcel post delivery",
      "shipToType": "SHIP_TO_ADDRESS",
      "estimatedShipDate": "2022-05-12T09:30:31.198Z",
      "estimatedDeliveryDate": "2022-05-12T09:30:31.198Z",
      "shipToPrice": 20,
      "shipToDiscount": 12.6,
      "discounts": [
        {
          "quantity": 1,
          "amount": 2.99,
          "unit": "AMOUNT_OFF",
          "value": 10,
          "promotionId": "SHIPFREE",
          "promotionCode": "SHIPFREE",
          "promotionName": "Free Shipping"
        }
      ],
      "shipToTaxTotal": 12.6,
      "shipmentInstructions": "Handle with care",
      "isInvoiced": true,
      "attributes": {
        "giftMessage": "[]"
      }
    }
  ]
}

Step 3: Integrate fabric OMS with Warehouse Management System (WMS)

Integrate fabric OMS with the WMS that you use to check the movement of inventory to fulfill orders. By integrating OMS with WMS, you allow the WMS to listen to allocation events that you created in the first step. Based on the shopper’s location, fabric OMS allocates orders to the nearest warehouse. To integrate OMS with the WMS you use, either:

  1. You (retailers) develop the integration software to communicate with fabric OMS, and maintain the integration layer on your own.
  2. Or, you (retailers) use a third-party integration software that’s developed to communicate with fabric OMS. For example, Bascom develops integration software for fabric OMS.

Step 4: Integrate OMS with Fraud Service

Use fraud endpoints to integrate OMS with Fraud service

Step 5: Create Shipment for the Allocations

Configure integration service with fabric OMS in such a way that integration service uses the create shipment endpoint (POST/v3/allocations/search) to ship the order to the shopper’s address after a warehouse is allocated with order details.

Optional Steps:

Search orders or allocation for additional information.

Get Allocations by orderId

You can get allocations by orderId using the POST/v3/allocations/search endpoint.

curl example:

curl --location --request POST 'https://api.fabric.inc/v3/allocations/search?offset=0&limit=10' \
--header 'Authorization: {{accessToken}}' \
--header 'x-site-context: {"account":"63310842f37ee100111e9fe3"}' \
--header 'Content-Type: application/json' \
--data-raw '
    {
  "sort": "-allocation.createdAt",
  "filters": [
    {
      "field": "allocation.items.orderId",
      "value": "Order_*",
      "condition": "EQ"
    },
    {
      "field": "allocation.items.itemId",
      "value": [
        "Item_1122",
        "Item_2233"
      ],
      "condition": "IN"
    }
  ]
}'

Search Order allocation by allocationId

Use the GET/allocations/{allocationId} endpoint to get order allocation details by allocationId.