Standard Checkout
Make sure all of the steps from the initial checkout setup are completed before you start
Follow these steps to start the integration:
Web Component Integration
How to integrate the checkout web component into your shop frontend
Loading the JavaScript bundle
Begin by either creating a static page or modifying the existing start page of your shop application. Then, insert the following JavaScript snippet into the head
element to load the Checkout bundle.
This script registers the web component with the browser and loads necessary assets (CSS, images).
Initialising the web component
To initialise and display the web component, add the <scayle-checkout>
tag at a desired place where the content needs to appear. Any additional element like a header or footer must be defined in the root document.
Example code how to set up the web component:
Attributes
jwt | Contains basketId , etc. as encoded and signed parameter. Find out how to generate the token here. More details about the JWT . | required |
access-token | The access token you receive after successful user authentication. Find out how to generate the token here. | required |
origin | Defines where the user is coming from, can be app or web . Passing the correct value is mandatory, otherwise users might encounter problems with e.g. payment processing. | required |
header-element | CSS selector pointing to the header element of the site (e.g. #header ), used to display Checkout notifications with the correct top offset (under the header) | required |
has-cookie-consent | Contains the value of the user's cookie consent. Only enabled when the value resolves to 'true'. It unlocks in-depth error tracking, A/B testing, etc. We strongly recommend adding it to the web component and passing in the correct cookie consent value. | required |
Note: All these attributes need to be set on the web component from the very start. If you mount the component first and then set e.g. the basket-id
attribute afterward, it will not be considered and not work correctly.
JWT attribute
To ensure integrity, you need to provide the jwt
attribute containing an encoded JSON payload. The value of the jwt
attribute has to be a common JWT (JSON web token) string. The payload of the JWT contains the properties likes basketId
to initialise the checkout. The JWT is then signed with the shopSecret
. Find the example here.
Name | Description | Type |
---|---|---|
iss | Identifies the principal that issued the token. It is typically a unique identifier or URL of the service responsible for generating the token. The recipient of the token can use this field to verify the authenticity of the issuer. See example. | optional |
aud | Intended recipients of the token. It is used to ensure that the token is only accepted by the services or users that are authorized. The value is typically a unique identifier or URI representing the audience. See example. | optional |
iat | issued at / current unix timestamp | required |
nbf | not-valid-before unix timestamp | optional |
exp | expiry unix timestamp | required |
basketId | sets the current basket id of the active session | required |
rBasketId | salted hash of basketId for rate-limiting purposes | optional |
customData | sets order-level custom data, must be a JSON string | optional |
carrier | sets preferred Carrier Group | optional |
campaignKey | set an active campaign, so that corresponding price-reductions are displayed in the checkout cart | optional |
preferredCollectionPoint | sets preferred collection point data as object | optional |
preferredCollectionPoint.id | collection point id | optional |
preferredCollectionPoint.type | collection point type. e.g. dhl_packstation | optional |
voucher | sets an pre-applied voucher code | optional |
If you require a more advanced configuration of your JWT parameters, please view the documentation.
Configuration
You can customise Checkout for your shops via the SCAYLE Panel. For details, follow the Configure & Customization section of this guide.

Checkout settings in the SCAYLE Panel
Tracking
Tracking events will be sent to the same Google Tag Manager (GTM) instance as the frontend application and the events will be attached to the same data layer object (window.dataLayer
).
This section is important for the customers hosting their own storefront. For all other clients, this step is done by SCAYLE.
Your shop frontend is responsible for implementing the connection with the GTM (Google Tag Manager) and the corresponding data layer. It's crucial to ensure the correct data layer setup. To achieve this, insert the given code segment at the top of the page, just before initializing the checkout.
Add the following into your code to forward the events:
For more details and available events see the tracking overview.
Loading Indicator
You can optionally improve the UX for customers with slow internet connection by implementing a custom loading indication on the page that renders the checkout application, within the <body> tag.
SCAYLE does not provide a custom loading animation, so it's up to you to design and implement the loading-indicator. Below, we only show how a sample implementation could look like.
Example HTML Code:
Example JS Code
The code below does two things:
- It listens for the
load
event emitted by the checkout application upon successful initialization, while also monitoring for theerror
event in case anything goes wrong during app bootstrap. - It sets the
display
CSS property of both<scayle-checkout>
and#loading-indicator
elements to show the checkout and hide custom loading indicator.
The script below can be added at the bottom of your body
tag:
Methods
The Checkout web component provides a method to update the used basket ID (string) via setBasketId
:
Events
You can find the event details in the table below. The list of event types may be extended in the future.
Event Name | Description | Trigger |
---|---|---|
load | Use this if you want to show your own loading indicator until the component is ready | Checkout has loaded all data for initial render |
error | An error state will be rendered by the Webcomponent. The load event will not be triggered in this case | Checkout has loaded all data for initial render, but there was an unrecoverable error |
intentConfirmation | Customer has made the decision to buy / intents to confirm the order | Customer clicks the "Pay Now" button |
invalid-access-token | When this event is sent, the storefront should refresh the access token and replace the access-token attribute on the web component with the new one. The checkout will then retry the failed request with the newly injected token. | The access token used to authenticate the user is expired |
authenticate | Deprecated This event is fired to inform the shop frontend that a user has logged in or registered during checkout | User logs in or signs up via Checkout |
Examples
Authenticate
The Checkout web component can notify the parent shop frontend about specific events or user actions. Your application can subscribe to these events by adding a listener, as shown in the below example:
The event listener needs to be added within the page where you load your Checkout bundle.
This is connected to legacy flow and should be deprecated after all tenants are moved to token based auth
Invalid access token event
Checkout dispatches the event invalid-access-token
to window.ayCheckoutFunctions
. This event signals to the storefront that the current access token is no longer valid and needs to be refreshed. Storefront in this case should get a new access token and provide it back to Checkout.
Example/default | |
---|---|
Checkout | /checkout |
Order Success Page (OSP) | /order/success |
Example URL | https://<shopName.domain>/order/success?cbd=<base64EncodedToken> |