How to integrate order delegation
Orders placed in SCAYLE’s Checkout are first delegated to SCAYLE’s Core system which holds a virtual stock for each item. SCAYLE cancels individual items (partial cancellation) or the full order (full cancellation) if certain items can not be fulfilled due to missing stock. As a consequence of this process, only fulfillable items are transferred as part of the delegation webhook request.
This delegation webhook request contains all required data, to fulfill the order. This includes ordered items with quantity, carrier and shipping data.
Configuration
To set up the delegation process, the destination middleware needs to provide an endpoint that can handle the request and respond as defined in the section below. The endpoint should enforce Basic Auth with username and password.
To configure an order delegation endpoint with Basic Auth, use the following scheme: https://username:[email protected]/path
When retrieving the configuration, username and password are masked.
There can be exactly 1 order_webhook_url per merchant, so if there is only one default merchant, only one order_webhook_url can be set.
Follow the instructions in the resource center for setting up order delegation here. Set up the order delegation destination in SCAYLE can be done through the Admin API. Details about the request can be found here.
Request
Approximately one minute after order confirmation, SCAYLE sends the following payload to the delegation URL configured during merchant configuration:
Example payload (click to expand)
This delegation webhook has a timeout of 15 seconds, which should be considered when designing processes around enriching the order data (e.g. with requests to the Admin API). The webhook is delivered at least once, and retried every two hours for up to 48 hours if your endpoint responds with an error or times out.
Response In a success case, SCAYLE expects a response with a HTTP status of 201 and the following payload in the response body:
Your endpoint must handle webhook requests idempotently, i.e. if the exact same order (even with a different X-Request-Id) is sent again, the endpoint must respond with the exact same response (status code and quantities per order item) and ensure that no duplicates are created.
Below is the mapping logic for processing order delegation requests from SCAYLE and the corresponding middleware responses:
orderDelegationResult | fixed value | “acknowledged” |
|---|---|---|
referenceKey | referenceKey | |
merchantReferenceKey | fulfillingMerchantKey | |
items | iterate through all items | - |
items[].referenceKey | items[].referenceKey | |
items[].merchantReferenceKey | items[].merchantKey | |
items[].deliverableQuantity | fixed value | e.g 1 |