Widget
Configuration and catalog endpoints for the embeddable widget.
The widget API serves the embeddable, merchant-branded gift card widget. Unlike other BFF sub-areas, these endpoints are CORS-public and do not require a merchant session, since the widget runs on third-party storefronts rather than inside the merchant dashboard.
Currently backed by demo data, not live merchant data
As of this writing, both endpoints below return fixed demo/fallback data rather than the requesting merchant's real configuration or catalog:
widget/configreads from an in-memoryMerchantStateobject that nothing in the codebase ever populates. It is always empty, so the endpoint always returns its hardcoded fallback values ("Your Brand",EUR, a fixed theme palette), regardless of which merchant the widget is embedded for.widget/giftcardsreads from a hardcoded two-item demo catalog (src/app/api/bff/widget/_data.ts), not the realCatalogOffermodel. Ademo_merchant_123override exists in the same file, but no othermerchantIdreturns merchant-specific items.
The contract documented here (request/response shape) reflects the real, current code. The data behind it does not yet reflect real merchants. Treat this sub-area as a demo/preview surface, not a production-ready integration point, until this is wired to live merchant and catalog data.
Get widget configuration
GET /api/bff/widget/configReturns branding and theme details for the widget to render.
Auth
None. CORS-public; responds to OPTIONS preflight for GET.
Request
No parameters.
Response
{
"ok": true,
"data": {
"merchant": {
"name": "Your Brand",
"logoUrl": "...",
"currency": "EUR",
"website": null
},
"theme": {
"primaryColor": "#111827",
"textColor": "#111827",
"accentColor": "#4F46E5"
}
}
}Cache-Control: no-store, max-age=0 is set on every response.
List gift cards for the widget
GET /api/bff/widget/giftcardsReturns the gift card catalog items the widget should display.
Auth
None. CORS-public; responds to OPTIONS preflight for GET.
Query parameters
| Param | Type | Required | Notes |
|---|---|---|---|
merchantId | string | no | Selects a merchant-specific item set if one exists in the demo data; otherwise the default demo set is returned. |
Response
{
"ok": true,
"data": {
"merchantId": "merchant-id-or-null",
"items": [
{
"id": "gc_digital_25",
"name": "Digital Gift Card",
"description": "Delivered instantly via email",
"currency": "EUR",
"denominations": [25, 50, 75, 100],
"imageUrl": "..."
}
],
"count": 1
}
}Errors
| Status | Cause |
|---|---|
| 400 | merchantId present but not a non-empty string. |
If a merchantId is supplied, a best-effort widget_catalog_viewed
analytics event is recorded and an analytics session cookie may be set on the
response.