This is a standalone reference app that demonstrates the same checkout + webhook flow as the raw API example, but with official SDKs:
- Backend session creation:
@lomi./sdk - Frontend embed helper (optional):
@lomi./embed
It is isolated in its own folder and does not require changes in other apps.
Use this when you want:
- Better DX and maintainability with SDK abstractions
- Fewer raw HTTP details in application code
- A clean template for production-like app code
Keep the raw API reference when you want transparent HTTP examples and language-agnostic docs.
From this directory:
pnpm install
cp .env.example .env
pnpm run devThen open:
Health check:
curl -s http://localhost:3001/api/healthLOMI_BASE_URL=https://api.lomi.africa
LOMI_API_KEY=your-lomi-api-key
LOMI_WEBHOOK_VERIFICATION_TOKEN=your-webhook-verification-token
LOMI_PUBLIC_KEY=lomi_pk_your_publishable_keyNotes:
LOMI_API_KEYis required on server to create checkout sessions.LOMI_PUBLIC_KEYis used by the browser embed SDK demo button.
- Creates checkout sessions using
LomiSDK(sdk.checkoutSessions.create(...)) - Supports dynamic amount, price-based, and line-items routes
- Verifies webhooks with HMAC SHA256 via
X-Lomi-Signature - Serves a local browser bundle path for
@lomi./embed:/vendor/lomi-embed.js
- Calls local server routes for checkout session creation
- Opens hosted checkout in a new tab
- Embeds hosted checkout in an iframe
- Uses
loadLomiCheckout(...)from@lomi./embedfor modal embed
GET /api/healthGET /api/configPOST /api/checkout/dynamicPOST /api/checkout/pricePOST /api/checkout/line-itemsPOST /api/webhooks/lomiGET /api/webhooks/events
- Persist webhook events in a DB and dedupe by event ID
- Add request validation middleware
- Add tests for webhook signature verification and checkout payload validation