Rail Pass List Embed
The Rail Pass List embed shows a list of rail passes on your website, without any programming. You choose which passes it shows.
The list fetches the passes from the All Aboard API. When the user selects a pass, a modal opens where they enter who is traveling and pick a class. They are then sent to All Aboard's hosted checkout, where they fill in the passengers' details and pay.
If your own code already has the passes, the Rail Pass Cards show them without an API key.
The list is responsive and adapts to the user's screen size. Scroll down to see an example.
Getting started
First load the script. It is a standard JavaScript module, so the script tag needs type="module".
<script
src="https://allaboard.eu/embed/aa-passbundle-list.js"
type="module"></script>The script registers the custom element aa-passbundle-list. You can then use it like any other HTML element.
<aa-passbundle-list
publicApiKey="your-api-key-here"
product="interrail-global-pass"></aa-passbundle-list>Cost centers and API keys
This embed runs on public web pages, so anyone who views the page can see its publicApiKey. Give it a key with only the base scope and the payment gateway scope: live and live:payments:stripe, or test and test:payments:stripe when testing. Never use a key that can read your orders or spend your wallet. Configuring embeds safely explains why.
Orders made through the embed are billed to a cost center. That cost center must have the payment gateway as a payment method, so that it matches the key's scope.
Attributes
Set these attributes on the <aa-passbundle-list> element to tell it which rail passes to show.
The list shows 2nd class prices. Until you set passengers, it shows the price for one youth aged 18. The user chooses the class and the passengers in the modal.
| Name | Description | Required |
|---|---|---|
publicApiKey |
Your public API key. You can find your API key in the Dashboard. | Yes |
product |
Identifier of the PassBundle product to display. For example, interrail-global-pass. |
No |
campaignCode |
The campaign code to use when fetching the PassBundle. For example, black-friday-2027. |
No |
badge |
A badge shown in the corner of the card, for example to highlight a current offer. | No |
label |
A heading shown above the travel days on each card. Either the text itself, or the name of a global function that is called with each PassBundle and returns the text for it. From JavaScript you can set the label property to a function directly. |
No |
costCenter |
The id of the CostCenter to bill each passenger's travel against. Defaults to the agent's default cost center. | No |
sessionId |
The session ID to use when calling the API. Can be any unique string that identifies the session. Used for analytics and troubleshooting. | No |
currency |
The currency to display prices in. For example, EUR or GBP. Defaults to the currency of the language. For example, DKK for da and SEK for sv. |
No |
language |
The language of the list and modal: en (the default), da, de, es, fr, nb or sv. |
No |
theme |
The color theme: light (the default), dark, or auto, which follows the visitor's light or dark system setting. |
No |
passengers |
The default set of passengers to use for finding availability. See below for details. | No |
The passengers attribute
There are two ways to set the passengers:
- As an attribute value: a comma-separated list of passenger types, each optionally followed by a dot and an age, such as
ADULT,YOUTH.8. - As a property, set directly on the
<aa-passbundle-list>element using JavaScript.
<aa-passbundle-list
publicApiKey="your-api-key-here"
product="interrail-global-pass"
passengers="ADULT,YOUTH.8"></aa-passbundle-list>const list = document.querySelector('aa-passbundle-list')
list.passengers = [{ type: 'ADULT' }, { type: 'YOUTH', age: 8 }]Example
Change the product, currency, language and badge to see the list update.