docs
  1. SCAYLE Resource Center
  2. Developer Guides
  3. Transactions & Orders
  4. Processing

Processing

Checkout webhooks

Webhooks allow you to subscribe to events in the customer and order lifecycle.

SCAYLE allows you to get notified when a certain event happens in the system. This feature is handled by webhooks.

Event Types

NameDescription
customer-createdOccurs whenever a new customer is registered or connected via a social network on the checkout application.
customer-updatedOccurs whenever an existing customer's attributes are extended or modified.
customer-loginTriggered on customer login.
customer-logoutTriggered on customer logout.
customer-anonymized

Occurs whenever an existing customer's data is removed from the system at the customer's request.
This event can currently only be triggered by the Customer Application.

customer-password-resetTriggered on customer password reset.
customer-address-createdTriggered whenever a customer saves a new address.
customer-address-updatedTriggered whenever a customer updates an existing address.
order-confirmedOccurs when payment reservation has been successfully completed, and the order is confirmed.
order-invoicedOccurs whenever an order is invoiced (after all items have been shipped).
order-cancelledOccurs whenever all items in an order have been cancelled.
order-item-out-of-stockOccurs during order delegation whenever an item is removed from the order, due to being out-of-stock when delegated to the merchant.
order-item-returnedOccurs whenever an item is returned by the customer.
newsletter-subscribedTriggered whenever a customer subscribes to a newsletter during Checkout.
payment-captureTriggered after the payment service provider is called after invoicing to capture a payment.
payment-refundTriggered after an item has been returned and invoiced.

Get Ready to Receive Orders

Since this guide covers the most basic backend configurations and integrations, we’ll assume you have a working front end and checkout in place. If you’re wondering how to get your front end up and running, refer to the relevant guide.

This section will focus on using webhooks to receive notifications when an order is placed. We’ll teach you about what a webhook is, how to subscribe to one, and how to process them when receiving an order.

SCAYLE supports several webhooks that can inform subscribed systems about events happening in SCAYLE. Please refer to Webhook Overview for more information.

This chapter will focus on 2 different types of webhooks: Both webhooks are non-blocking webhooks, meaning they are asynchronous and therefore do not block the customer’s actions.
In other words, the customer won’t see a loading icon and need to wait.

The response from an external system doesn't affect the process logic. These types of webhooks serve as notification channels only. SCAYLE also supports blocking webhooks in some cases. Please refer to Blocking Webhooks for more information.

Webhook typeDescription
Order-confirmedThis webhook is triggered when an order is successfully confirmed in SCAYLE. The confirmation happens after a user clicks on “confirm order” in the last step of the checkout flow and is then redirected to the order success page. At this step, the payment has been successfully authorized.
Item-out-of-stockThis webhook is triggered when items of a confirmed order cannot be fulfilled after considering Backbone’s virtual stock handling. This is a rare case but should be covered by canceling those items also on the receiver's side.

Subscribe to webhooks

To receive webhooks, you need an external system that can receive HTTP requests.

You can subscribe to webhooks in 2 different ways:

  1. Use the Admin API.
  2. Use SCAYLE Panel:
    - Go to Shops > Shop > Storefront > Checkout Settings > Webhooks.
  3. Click Add Webhook and enter Authentication fields as well as the Type of the webhook event.

In most cases, you’ll subscribe to webhooks just once and not make any further changes, so we recommend doing it via the SCAYLE Panel.

You can subscribe to as many webhooks as you need, and subscribing to one webhook covers all shop countries within a shop. For example, if you subscribe to the order-confirmed webhook in a specific shop country of a shop that has multiple shop countries, the subscription also counts for all other shop countries, but not for other shops. It may take up to 5 minutes for a new subscription to become active.

Tips for integrating webhooks

  • Webhooks come with an integrated retry mechanism. If the downstream service responds with an error code like 5XX, webhooks are repeated for up to 2 days. You can make use of this functionality instead of rebuilding it on your own.
  • Consider that webhooks are not guaranteed to be sent or received in the correct order. Your downstream system must be able to handle that. Keep this in mind especially when dealing with the order-confirmed and the item-out-of-stock webhook.
  • We recommend securing your receiving web service by using basic auth.
  • Your system should be able to handle concurrent requests.
  • Ensure idempotency in your system because we cannot guarantee that the webhook will only be delivered once.

Subscribe to webhooks and manage them

As previously mentioned, subscribing to a specific webhook in one shop country means the webhook is valid for all other shop countries. As we created three country shops for our Fashion Store , we only need to add the webhook subscription to one shop country.

You can add webhooks by navigating to Shops > Shop > Storefront > Checkout Settings > Admin API Webhooks:

Admin Webhooks

Click Add New Webhook and enter Version, URL fields as well as the Type of webhook event you would like to subscribe to. The URL should reflect the downstream service that receives the event. You can add basic auth to the URL. In our case, we assume the endpoint is not protected (not recommended). We also assume that the URL is the same for all shop countries. Then click save. Remember, it may take up to 5 minutes for a new subscription to become active.

Add Webhook

Then repeat the same process with the “item-out-of-stock” event.

To understand the entire webhook payload see available webhook events.

Let’s assume we’ve already received our first order, placed in the German shop country. The corresponding payload would look like this (we’ve simplified the payload in this case.)

Simplified payload:

Payload
{
    "key": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "meta":
    {
        "xRequestId": "1798e99a-711f-4f06-ae4c-ce86ed1331b8"
    },
    "occurredAt": "2023-11-06T15:01:26+02:00",
    "type": "order-confirmed",
    "payload":
    {
        "address":
        {
            "billing":
            {
                "id": 998,
                "street": "Street",
                "houseNumber": "1",
                "additional": "erste Stock",
                "zipCode": "123456",
                "city": "Hamburg",
                "countryCode": "DEU",
                "isDefault":
                {
                    "billing": false,
                    "shipping": true
                },
                "recipient":
                {
                    "firstName": "John",
                    "gender": "m",
                    "lastName": "Doe",
                    "title": "Prof."
                }
            },
            "shipping":
            {
                "id": 998,
                "street": "Street",
                "houseNumber": "1",
                "additional": "erste Stock",
                "zipCode": "123456",
                "city": "Hamburg",
                "countryCode": "DEU",
                "isDefault":
                {
                    "billing": false,
                    "shipping": true
                },
                "recipient":
                {
                    "firstName": "John",
                    "gender": "m",
                    "lastName": "Doe",
                    "title": "Prof."
                }
            }
        },
        "basketKey": "basket-c6v7k4eer1",
        "confirmedAt": "2023-11-07 14:30:27",
        "cost":
        {
            "tax":
            {
                "vat":
                {
                    "amount": 11
                }
            },
            "withTax": 1390,
            "withoutTax": 1168
        },
        "currencyCode": "EUR",
        "customer":
        {
            "id": 9876
        },
        "id": 123,
        "items":
        [
            {
                "id": 1,
                "packageId": 1,
                "price":
                {
                    "tax":
                    {
                        "vat":
                        {
                            "amount": 190,
                            "rate": 1
                        }
                    },
                    "withTax": 1190,
                    "withoutTax": 1000
                },
                "product":
                {
                    "id": 1,
                    "referenceKey": "FS-100-black"
                },
                "key": "ac834d23e689u678",
                "status": "available",
                "variant":
                {
                    "id": 1,
                    "referenceKey": "FS-100-black-S"
                },
                "warehouseId": 1
            }
        ],
        "packages":
        [
            {
                "carrierKey": "dhl",
                "deliveryDate":
                {
                    "maximum": "2023-11-08",
                    "minimum": "2023-11-12"
                },
                "deliveryStatus": "open",
                "id": 1
            }
        ],
        "payment":
        [
            {
                "amount": 1190,
                "data":
                {
                    "CCBrand": "VISA",
                    "CCExpiry": "202005",
                    "IPCity": "charlottenburg",
                    "IPLatitude": "52.5151",
                    "IPLongitude": "13.3053",
                    "IPState": "berlin",
                    "IPZone": "276",
                    "IPZoneA2": "de"
                },
                "key": "computop_creditcard",
                "transactionKey": "creditcard-abcde"
            }
        ],
        "shopCountry":
        {
            "id": 1,
            "shopKey": "fs",
            "countryCode": "DE",
            "defaultLanguageCode": "de_DE",
            "supportedLanguageCodes":
            [
                "de_DE"
            ],
            "active": true,
            "deleted": false,
            "url": "www.example.com",
            "currencyCode": "EUR"
        }
    }
}

Note the following information with regard to this payload:

PropertyTypeDescription
idINTEGERContains the unique identifier of the order. You’ll need this to send order updates later on. The identifier is unique across all shop countries you created.
addressOBJECTContain the billing and shipping address of the customer.
shopCountryOBJECTProvide details about the shop country where this order was placed.
costOBJECTShows details about the costs, such as the total costs, taxes, but also applied fees or discounts like vouchers.
paymentARRAY OBJECTShows details about the payment method, and the unique identifier of the PSP, so you can capture the payment or refund it.
itemsARRAY OBJECTShows all ordered items. Each element represents a single line item. Even if the customer purchased the same variant twice, you would see two elements within the array.

You've subscribed to 2 webhooks for all your shop countries. Now you’ll be notified when someone places an order or an item is out of stock.

Receive Payment Event Notifications

If you want to be notified when a payment capture or refund happens, you need to subscribe to payment-capture and payment-refund events respectfully.

payment-capture webhooks will be triggered any time a late payment is captured. An individual webhook will be sent per payment capture and per payment type.

payment-refund webhooks are triggered whenever a refund payment is performed. An individual webhook will be sent for each individual payment refund attempt.

Example payload:

Payload
{
    "key": "513a393d-87b0-44b8-a11c-43cf9dd47e46",
    "locale": {
        "appId": 999,
        "countryCode": "DEU",
        "currencyCode": "EUR",
        "languageCode": "de-DE"
    },
    "metadata": {
        "operationStatus": "successful",
        "transaction_id": "2024-07-09T14:48:11+02:00"
    },
    "occurredAt": "2024-06-26T15:46:17+02:00",
    "payload": {
        "id": 123,
        "address": {
            "billing": {
                "id": 998,
                "additional": "c/o AboutYou",
                "city": "Hamburg",
                "countryCode": "DEU",
                "houseNumber": "12",
                "isDefault": {
                    "billing": false,
                    "shipping": false
                },
                "phone": "089999123",
                "recipient": {
                    "firstName": "Max",
                    "gender": "m",
                    "lastName": "Mustermann",
                    "type": "personal"
                },
                "referenceKey": "address-7656",
                "state": "Sachsen",
                "street": "Wolfgangsweg",
                "zipCode": "20459",
                "createdAt": "2018-01-20T09:30:15+00:00",
                "updatedAt": "2018-01-20T09:30:15+00:00"
            },
            "forward": {
                "additional": "c/o AboutYou",
                "city": "Hamburg",
                "countryCode": "DEU",
                "houseNumber": "12",
                "recipient": {
                    "firstName": "Max",
                    "gender": "m",
                    "lastName": "Mustermann",
                    "type": "personal"
                },
                "state": "Sachsen",
                "street": "Wolfgangsweg",
                "zipCode": "20459",
                "createdAt": "2018-11-29T05:20:13+01:00",
                "updatedAt": "2018-11-29T05:20:13+01:00"
            },
            "shipping": {
                "id": 998,
                "city": "Hamburg",
                "collectionPoint": {
                    "customerKey": "bced-234-234",
                    "description": "Pedro's Kiosk",
                    "key": "12345-a",
                    "type": "hermes_parcelshop"
                },
                "countryCode": "DEU",
                "houseNumber": "10",
                "isDefault": {
                    "billing": false,
                    "shipping": true
                },
                "phone": "089999123",
                "recipient": {
                    "firstName": "Max",
                    "gender": "m",
                    "lastName": "Mustermann",
                    "type": "personal"
                },
                "referenceKey": "address-7656",
                "state": "Sachsen",
                "street": "Domstrasse",
                "zipCode": "20459",
                "createdAt": "2018-01-20T09:30:15+00:00",
                "updatedAt": "2018-01-20T09:30:15+00:00"
            }
        },
        "basketKey": "basket-c6v7k4eer1",
        "confirmedAt": "2018-01-20T11:30:15+00:00",
        "cost": {
            "appliedReductions": [
                {
                    "amount": {
                        "absoluteWithTax": 100,
                        "relative": 0.5
                    },
                    "category": "voucher",
                    "code": "ayou123",
                    "displayName": "ayou123",
                    "type": "absolute"
                }
            ],
            "costCapture": 1390,
            "itemGroups": {
                "1234567": {
                    "brutto": 1190,
                    "bruttoDiscount": 0,
                    "bruttoDiscountWithoutMainProduct": 0,
                    "bruttoWithoutMainProduct": 1190,
                    "netto": 1000,
                    "nettoWithoutMainProduct": 1000,
                    "tax": 190,
                    "taxWithoutMainProduct": 190
                }
            },
            "tax": {
            },
            "withoutTax": 1000,
            "withoutTaxWithMembershipDiscount": 1234,
            "withTax": 1190,
            "withTaxWithMembershipDiscountWithoutServiceCosts": 1337
        },
        "currencyCode": "EUR",
        "customer": {
            "id": 9876,
            "authentication": {
                "type": "password"
            },
            "birthDate": "1981-02-02",
            "customData": {
                "isVip": true
            },
            "email": "[email protected]",
            "firstName": "Max",
            "gender": "f",
            "groups": [
                "employee",
                "vip"
            ],
            "ipAddress": "172.19.0.2",
            "lastName": "Mustermann",
            "phone": "0049/1234567890",
            "publicKey": "customer-1234",
            "referenceKey": "customer-1234",
            "status": {
                "isActive": true,
                "isGuestCustomer": false,
                "isTestCustomer": false
            },
            "title": "Madam",
            "type": "retail",
            "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
            "createdAt": "2018-01-20T09:30:15+00:00",
            "updatedAt": "2018-01-20T09:30:15+00:00"
        },
        "detailedStatus": {
            "billing": {
                "code": "billing_payment_pending",
                "name": "Zahlung reserviert"
            },
            "order": {
                "code": "invoice_completed",
                "name": "Invoiced"
            },
            "shipping": {
                "code": "shipping_partially_returned",
                "name": "Teilweise Retoure"
            }
        },
        "invoicedAt": "2018-01-22T11:30:15+00:00",
        "items": [
            {
                "availableQuantity": 18,
                "campaignKey": "fooCampaign",
                "customData": {
                    "key": "value"
                },
                "deliveryForecast": {
                    "subsequentDelivery": {
                        "key": "christmas"
                    }
                },
                "isManuallyReturnedByCci": true,
                "itemGroup": {
                    "id": "ab123",
                    "isMainItem": true,
                    "isRequired": true
                },
                "key": "ac834d23e689u678",
                "lowestPriorPrice": {
                    "relativeDifferenceToPrice": -0.25,
                    "withTax": 1000
                },
                "packageId": 1,
                "price": {
                    "appliedReductions": [
                        {
                            "amount": {
                                "absoluteWithTax": 100,
                                "relative": 0.5
                            },
                            "category": "sale",
                            "code": "ayou123",
                            "type": "relative"
                        },
                        {
                            "amount": {
                                "absoluteWithTax": 800,
                                "relative": 0.4
                            },
                            "category": "promotion",
                            "type": "absolute"
                        }
                    ],
                    "overrideWithoutTax": 1357,
                    "overrideWithTax": 1675,
                    "reference": {
                        "size": "100",
                        "unit": "ml",
                        "withTax": 595
                    },
                    "tax": {
                        "vat": {
                            "amount": 190,
                            "rate": 0.19
                        }
                    },
                    "undiscountedWithOutTax": 1000,
                    "undiscountedWithTax": 1190,
                    "withoutTax": 1000,
                    "withTax": 1190
                },
                "product": {
                    "id": 4564545,
                    "advancedAttributes": {
                        "materialCompositionTextile": {
                            "key": "materialCompositionTextile",
                            "label": "Materialzusammensetzung",
                            "values": [
                                {
                                    "fieldSet": [
                                        [
                                            {
                                                "value": "Lining"
                                            }
                                        ]
                                    ],
                                    "groupSet": [
                                        {
                                            "fieldSet": [
                                                [
                                                    {
                                                        "value": 80
                                                    },
                                                    {
                                                        "unit": "%"
                                                    },
                                                    {
                                                        "material": "Cotton"
                                                    }
                                                ]
                                            ],
                                            "groupSet": [
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    },
                    "attributes": {
                        "description": {
                            "key": "description",
                            "label": "Beschreibung",
                            "values": [
                                {
                                    "id": 1234,
                                    "label": "A descriptive string (possibly including HTML)",
                                    "value": "Optional value"
                                }
                            ]
                        }
                    },
                    "categories": [
                        [
                            {
                                "categoryId": 20201,
                                "categoryName": "Frauen",
                                "categoryProperties": {
                                    "priority": {
                                        "name": "priority",
                                        "value": "1"
                                    }
                                },
                                "categoryUrl": "/frauen"
                            }
                        ]
                    ],
                    "definingAttributes": [
                        {
                            "key": "color",
                            "label": "Farbe"
                        }
                    ],
                    "images": [
                        {
                            "attributes": {
                                "description": {
                                    "key": "description",
                                    "label": "Beschreibung",
                                    "values": [
                                        {
                                            "label": "A descriptive string (possibly including HTML)"
                                        }
                                    ]
                                }
                            },
                            "hash": "9f6c628a98106dcce2bc5a4ac1de9c14"
                        }
                    ],
                    "masterKey": "480306626-1",
                    "name": "Chelsea Boots",
                    "createdAt": "2018-01-20T09:30:15+00:00",
                    "updatedAt": "2018-01-20T09:30:15+00:00"
                },
                "promotion": {
                    "id": "649178aa530da10426f3f8d1",
                    "code": "PROMO0124",
                    "displayName": "Winter sales 2024",
                    "name": "PromoABC",
                    "version": "649178aa530da10426f3f8d2"
                },
                "status": "available",
                "variant": {
                    "id": 1234567,
                    "attributes": {
                        "vendorSize": {
                            "key": "vendorSize",
                            "label": "Größe",
                            "values": [
                                {
                                    "id": 25472,
                                    "label": "34",
                                    "value": "Thirty Four"
                                }
                            ]
                        }
                    },
                    "referenceKey": "563843898",
                    "stock": {
                        "customData": {
                        },
                        "deliveryForecast": {
                            "deliverable": "directShipping",
                            "subsequentDelivery": "christmas"
                        },
                        "isSellableWithoutStock": false,
                        "quantity": 18,
                        "supplierId": 271
                    },
                    "createdAt": "2018-01-20T09:30:15+00:00",
                    "updatedAt": "2018-01-20T09:30:15+00:00"
                },
                "warehouseId": 123456,
                "warehousePackageGroupId": 1,
                "createdAt": "2018-01-20T09:30:15+00:00",
                "updatedAt": "2018-01-20T09:30:15+00:00"
            }
        ],
        "membershipDiscount": {
            "membershipCardId": 1,
            "pointsUsed": 1356,
            "reductionValue": 127,
            "tax": 0
        },
        "packages": [
            {
                "id": 1,
                "carrierKey": "dhl",
                "deliveryDate": {
                    "maximum": "2018-02-05",
                    "minimum": "2018-02-02"
                },
                "deliveryStatus": "open",
                "hasExpectedAvailabilityAt": false,
                "returnIdentCode": "123-123",
                "shipmentKey": "shpmnt-123",
                "tracking": {
                    "id": "79003131200523",
                    "url": "https://tracking.hermesworld.com/?TrackID=79003131200523"
                }
            }
        ],
        "payment": [
            {
                "amount": 1190,
                "data": {
                    "creditCardBrand": "Maestro",
                    "PayID": "12a6453e09876ca12ba857c11dec741b",
                    "success": true,
                    "transaction_id": "ayro-1234-4234234234-12345",
                    "type": "Maestro",
                    "UserData": {
                        "requestToken": "28fyQ4zGfL9Pk"
                    },
                    "XID": [
                        "a232cb32df28790a8b726ed66f8b928a"
                    ]
                },
                "isGiftCard": false,
                "key": "computop_maestro",
                "payload": {
                    "countryCode": "DE",
                    "customerId": 1,
                    "deliveryDate": {
                        "date": "2024-07-03 15:35:04.117012",
                        "timezone": "Europe/Berlin",
                        "timezone_type": 3
                    },
                    "giftCard": [
                    ],
                    "order": {
                        "currency": "EUR",
                        "initialPrice": null,
                        "items": [
                            {
                                "brand": null,
                                "bruttoDiscount": 0,
                                "description": null,
                                "descriptionAddition": "mischfarben  ",
                                "merchantProductId": null,
                                "nettoPrice": 1400,
                                "orderProductId": 1,
                                "price": 1400,
                                "quantity": 1,
                                "tax": 0,
                                "undiscountedUnitPrice": 1400,
                                "unitPrice": 1400,
                                "unitPriceWithoutTaxWithVoucher": 1400,
                                "unitTaxValueWithVoucher": 0,
                                "variantId": 1,
                                "voucherCode": ""
                            }
                        ],
                        "total": 1400
                    },
                    "orderId": 1,
                    "orderKey": "",
                    "refundForLateShipment": false,
                    "returnedOrderProductIds": [
                        1
                    ],
                    "shipmentReturnWindowId": 121720572,
                    "voucher": {
                        "code": "8B27419D",
                        "description": "Online_Coop DE Corporate Benefits BK15 MOV75 0624",
                        "reductionValue": 15,
                        "tax": 19,
                        "type": "percent"
                    }
                },
                "transactionKey": "ayro-1234-4234234234-12345"
            }
        ],
        "promotions": [
            {
                "id": "659d4e0cc9f5f7c3c7ba3728",
                "code": "test",
                "displayName": "test",
                "reduction": 123123,
                "version": "659d4e0cc9f5f7c3c7ba3728"
            }
        ],
        "publicKey": "order-2234",
        "referenceKey": "order-2234",
        "shipping": {
            "deliveredOn": "2019-11-29",
            "policy": "delivery_deadline"
        },
        "status": "invoice_completed",
        "vouchers": [
            {
                "id": 198234,
                "applicableItems": [
                    {
                        "isApplied": true,
                        "key": "a87ff679a2f3e71d9181a67b7542122c"
                    },
                    {
                        "isApplied": false,
                        "key": "eccbc87e4b5ce2fe28308fd9f2a7baf3"
                    }
                ],
                "code": "fashion2020",
                "type": "absolute",
                "value": 1000,
                "voucherId": 33413
            }
        ],
        "createdAt": "2018-01-20T09:30:15+00:00",
        "updatedAt": "2018-01-20T09:30:15+00:00"
    },
    "type": "payment-capture"
}

The payload is very similar to the order payload, with an important difference, the metadata key on the root level.

PropertyTypeDescription
transaction_id
STRINGThis is used by the PSP to identify the transaction.
operationStatus
ENUM("successful", "failed")Shows if the payment capture/refund succeded or failed.

To know which one of the payment objects inside {}.payload.payment object list triggered the event, the following can be considered:

  • {}.metadata.transaction_id == {}.payload.payment.{}.transactionKey.
  • {}.payload.payment.{}.payload.order.items shows for which items were captured or refunded. Only the payment object that is triggering the event contains this data.

Send Order Updates

You’re almost done! In this final section, we’ll teach you all about the order updates you can send via the Admin API.

Order updates in SCAYLE

After receiving an order in your system, you can send three types of order-updates via the Admin API, which are reflected in the data retrieved by APIs or can trigger:

  • transactional mails
  • payment operations like capturing or refunding
  • webhooks
  • the invoice

It is completely optional to send order-updates. However, if you require features of SCAYLE to be triggered (see above), you should consider sending them.

In order to update orders, you use following methods:

EndpointDescription
Create ShipmentUsed to notify SCAYLE, about items, which were shipped (usually physically shipped).
Create CancellationUsed to notify SCAYLE, about items, which cannot be fulfilled.
Create ReturnUsed to notify SCAYLE, about items, which were returned by the customer.
  • When you have an order with multiple items and you send them out physically in a package, each package should be represented by one create-shipment request.
  • The property shipmentKey can be used to send the track & trace id along with the request, which can be retrieved in the Frontend using the Customer Account API in order to generate the tracking url, see getApiCustomerOrder.
  • You’ll need the returnKey set via the create-shipment endpoint to send returns, so you should use a retrievable identifier. We recommend using the same orderItemId as the returnKey when sending shipments if you don’t need a different key. By doing this, you do not have to continue using the returnKey because the orderItemId should work anyways.
  • A cancellation can be sent whenever an order item cannot be fulfilled. Cancellations can be sent independently from the current order item state. For example, if an order item was already shipped, it can also be canceled afterward. The same applies to returns.
  • One cancellation request can contain particular order items or all order items of one order.

What else to consider when sending order updates

  • When you have an order with multiple items and you send them out physically in a package, each package should be represented by one create-shipment request.
  • The property shipmentKey can be used to send the track & trace id along with the request, which can be retrieved in the Frontend using the Customer Account API in order to generate the tracking url, see getApiCustomerOrder.
  • You’ll need the returnKey set via the create-shipment endpoint to send returns, so you should use a retrievable identifier. We recommend using the same orderItemId as the returnKey when sending shipments if you don’t need a different key. By doing this, you do not have to continue using the returnKey because the orderItemId should work anyways.
  • A cancellation can be sent whenever an order item cannot be fulfilled. Cancellations can be sent independently from the current order item state. For example, if an order item was already shipped, it can also be canceled afterward. The same applies to returns.
  • One cancellation request can contain particular order items or all order items of one order.

Sending order updates for Fashion Store

In the last chapter, we already received our first order in the German shop.

Now let’s assume the order has been physically fulfilled and one package was shipped via DHL. In this case, you would send out the following shipment:

{
  "shopKey": "fs",
  "countryCode": "DE",
  "carrier": "DHL",
  "deliveryDate": "2023-11-08 14:30:27",
  "items": [
    {
      "orderItemId": 1,
      "returnKey": "550357807160"
    }
  ],
  "orderId": 123,
  "returnIdentCode": "123456789012",
  "shipmentKey": "582301b967d97"
}
ParameterDescription
shopKeyMust match the shopKey, where the order was initially placed in. See shopCountry.shopKey in the order-confirmed webhook.
countryCodeMust match the countryCode, where the order was initially placed in. See shopCountry.countryCode in the order-confirmed webhook.
carrierThe carrier the order was sent out with.
deliveryDateDefines the timestamp of the package leaving the warehouse.
items.orderItemIdCorresponds to the id of the order item received within the order-confirmed webhook and identifies an order line item uniquely.
items.returnKeyUsed to map future return requests to the corresponding order line item.
orderIdCorresponds to the id received within the order-confirmed webhook and uniquely identifies an order.
returnIdentCodeUnique ID generated for product return (in case the customer prefers to return the product later).
shipmentKeyA key that is assigned to uniquely identify a shipment. For example, the track&trace of the carrier.

Unfortunately, the customer decided to return the item, so we assume that the return was processed. In that case, we need to send the order update to SCAYLE using the following operation create return

[
    {
        "received": "2023-11-09 07:30:27",
        "returnKey": "550357807160"
    }
]
ParameterDescription
receivedThe property defines the date the return was physically received.
returnKeyThe value must match the returnKey set within the previous shipment request.

That’s it! You successfully updated your first order and made it through the guide.

Wrapping Up

Congratulations! You’ve learned how to configure and integrate the basic features and endpoints necessary to run an eCommerce business in SCAYLE. Soon we will also have a complementary tutorial available that guides you through the basic configurations and integrations you’ll need to consider for the front end of your business.

Of course, there are many more features and APIs to discover, so please feel free to consult the following resources: