1 Β· SmartPlanner's backend mints a
15-min, origin-bound token per drawer-open. The scope is the itinerary ref β the
TripBuilder itineraryId or the itinerary's externalRefId
(our SG-BOOKING-####). BFM resolves either server-side:
POST https://bfm.p2p.travel/v1/widget/token
Header: X-Mint-Key: <shared key>
Body: { "ref": "<itineraryId | externalRefId>", "origin": "https://<embedding-origin>" }
// legacy { "bookingRef": β¦ } is still accepted as an alias of ref
β 200 { "token": "<jwt>", "exp": <unix> }
2 Β· Load the widget bundle once and
place the element β it self-registers <bfm-seat-map>:
<script type="module" src="https://bfm.p2p.travel/assets/bfm-seat-map.es.js"></script>
<bfm-seat-map
api-base="https://bfm.p2p.travel"
itinerary-ref="<itineraryId | externalRefId>"
token="<jwt>"
lang="en"></bfm-seat-map>
// emits: new CustomEvent('bfm-seat-map',{ detail:{ action:'ready'|'assigned', β¦ }})
Every seat call carries that token,
is scoped to its ref, and the request origin must match the token.
lang defaults to en; set lang="de" for German.
iframe fallback (still supported). Where a host can't run the custom element, embed
<iframe src=".../widget.html"> and hand the token over via
postMessage({ type:'bfm:set-token', token, ref, apiBase })
(bookingRef also accepted). Same token, same API, same events.