@shoppexio/checkout-core
v0.1.0
Published
Framework-agnostic core for Shoppex checkout sessions: browser-facing session contract and gateway mapping shared by hosted, inline, and headless checkout surfaces
Maintainers
Readme
@shoppexio/checkout-core
Framework-agnostic core for Shoppex checkout sessions.
This package holds the single browser-facing session contract and the gateway → contract mapping shared across every checkout surface:
apps/checkout— hosted + inline (iframe) buyer UI@shoppexio/checkout-js/headless— merchant-owned UI
It contains no UI and no provider SDK code — only types and the mapping
logic that must stay identical across surfaces, so there is exactly one payment
engine and one contract (see docs/architecture/adr/ADR-0021-headless-checkout-sessions.md).
What's here
contract/payment-session.ts—CheckoutPaymentSessiondiscriminated union (embed | redirect | address | balance | manual) + authoritativeCheckoutPaymentStatus.contract/checkout-session.ts— session create/read/start HTTP shapes.mapping/map-payment-session.ts—mapToCheckoutPaymentSession()maps each gateway's provider-specific payload into the union. Fail-fast: an unsatisfiable class throwsCheckoutSessionMappingError(never a silent empty session).
Design rule
Render against kind, not against the provider name. redirect, address,
balance, and manual are provider-independent; only embed carries a
provider sub-discriminator because each SDK (Stripe / Square / SumUp / PayPal)
needs structurally different mount data.
