docs
  1. SCAYLE Resource Center
  2. Developer Guides
  3. Products
  4. Manage Merchants
  5. Order delegation

Order delegation

General

Order Delegation URL which is specified during the update or create merchant will be utilized for delegating orders to merchants during order creation this ensures that order details are accurately passed on to the respective merchants, allowing them to process and fulfil the orders efficiently.

The following status can be assigned to the order depending on the status of the order delegation.

  • failed: The delegation of the order to the corresponding merchant failed.
  • delegated: Order was delegated successfully to the merchant but not acknowledged yet.
  • acknowledged: Order was delegated and acknowledged by the merchant.

This webhook works in blocking mode, meaning requests are sent to them synchronously during the order creation.

{
    "addresses": {
        "billing": {
            "additional": "string",
            "city": "string",
            "collectionPoint": {
                "customerKey": "string",
                "description": "string",
                "key": "string",
                "type": "string"
            },
            "countryCode": "string",
            "firstName": "string",
            "gender": "string",
            "houseNumber": "string",
            "lastName": "string",
            "phoneNumber": "string",
            "state": "string",
            "street": "string",
            "streetHouseNumber": "string",
            "zipCode": "string"
        },
        "shipping": {
            "additional": "string",
            "city": "string",
            "collectionPoint": {
                "customerKey": "string",
                "description": "string",
                "key": "string",
                "type": "string"
            },
            "countryCode": "string",
            "firstName": "string",
            "gender": "string",
            "houseNumber": "string",
            "lastName": "string",
            "phoneNumber": "string",
            "state": "string",
            "street": "string",
            "streetHouseNumber": "string",
            "zipCode": "string"
        }
    },
    "carrier": {
        "key": "string"
    },
    "companyId": "integer",
    "creditCardType": "string",
    "customData": "object",
    "customer": {
        "customData": "string",
        "email": "string",
        "publicKey": "string",
        "referenceKey": "string",
        "taxNumber": "string",
        "vendorReferenceKey": "string"
    },
    "customerPublicKey": "string",
    "fulfillingMerchantKey": "string",
    "id": "integer",
    "items": [
        {
            "currencyCode": "string",
            "customData": "object",
            "deliveryDate": {
                "maximum": "datetime",
                "minimum": "datetime"
            },
            "id": "integer",
            "itemGroup": {
                "id": "string",
                "isMainItem": "bool",
                "isRequired": "bool"
            },
            "localizedName": "string",
            "merchantKey": "string",
            "merchantProductVariantId": "integer",
            "merchantProductVariantReferenceKey": "string",
            "merchantReservationKey": "string",
            "name": "string",
            "packageId": "integer",
            "packagingGroupId": "integer",
            "price": "integer",
            "productVariantId": "integer",
            "purchasePrice": "integer",
            "quantity": "integer",
            "referenceKey": "string",
            "shippingWarehouseId": "integer",
            "tax": "integer",
            "vendorReferenceKey": "string",
            "vendorSize": "string",
            "warehouseId": "integer"
        }
    ],
    "languageCode": "string",
    "paymentMethod": "string",
    "referenceKey": "string",
    "serviceCosts": [
        {
            "additionalProp1": "object"
        }
    ],
    "shopId": "integer",
    "vendorReferenceKey": "string"
}

The order, including the items, is stored in SCAYLE before triggering the webhook. On receiving the order delegation request, if the endpoint responds with a status code other than 201 or an invalid response body, SCAYLE will automatically retry the request in increasing intervals for up to two days. Every retry will contain the same data. The webhook’s response must be idempotent, this means if the same order is being sent again, the webhook must respond with the same response (status code and quantities per order item).

{
  "orderDelegationResult": "string",
  "referenceKey": "string",
  "merchantReferenceKey": "string",
  "items": [
    {
      "referenceKey": "string",
      "merchantReferenceKey": "string",
      "deliverableQuantity": "integer",
      "itemGroup": {
        "id": "string",
        "isMainItem": "bool",
        "isRequired": "bool"
      }
    }
  ]
}

The orderDelegationResult can be either delegated or acknowledged. In a two-step process, set it to delegated initially and later update to acknowledged. If not using a two-step process, return acknowledged immediately.

For an order item to be deliverable, the response should contain a deliverableQuantity greater than 0. Order item is identified by items.*.id in the request and referenceKey in the response. If deliverableQuantity=0 is returned, SCAYLE will mark the item as unavailable.

Once responses from all merchants are collected, the customer will either:

  • Receive an indication in the confirmation email that the item is unavailable if other delegations succeeded, or
  • Receive a cancellation email if no delegations succeed.

Even if an item is undeliverable or cancelled, it will not be removed from the order and remains linked to it. If the order was paid in advance, customers will be refunded once the order is invoiced.