Skip to content

Core

The shared commerce conventions every EdgeCart module uses — money, currency, IDs, errors, and pagination.

The Core module holds the conventions shared by every other commerce module. It is not a business area with its own admin screen; it is the reason prices, identifiers, errors, and lists behave the same way across the platform.

Features

  • Money and currency — amounts are stored as integer minor units and paired with an ISO currency code.
  • Identifiers — prefixed, sortable IDs for commerce records.
  • Pagination and field selection — consistent list envelopes and fields= projection across the API.
  • Validation and errors — shared input validation and a single API error shape.
  • Payment provider contract — the interface a payment provider implements, so Stripe and the manual provider behave consistently.
  • Database access — the shared D1 schema and database factory used by the commerce modules.

Key concepts

Concept What it means
Minor units The smallest unit of a currency. 2050 in USD means $20.50.
Currency code A lowercase ISO code such as usd or eur.
Store scope Commerce rows are scoped by store_id, even though the admin is single-store.
Error envelope API errors use { type, message, code }.
List envelope List responses use { <plural>, count, offset, limit }.
Field selection fields= chooses which fields a response includes.
Provider contract The operations a payment provider must support: authorize, capture, refund, and webhook handling.

How it fits

Every module uses Core:

  • Admin and Storefront APIs return the same error and list shapes.
  • Catalog, Cart, Orders, and Payments pass money as minor units; the UI formats it for display.
  • Payments implements its provider adapters against the Core contract.
  • Plugins and merchant rules receive and return the same money shape.

Common tasks

  • Merchant — you see Core’s results as consistent prices, totals, and error messages in the admin. You do not configure it directly.
  • Developer — read API conventions for money, errors, pagination, field selection, idempotency, and rate limits. Browse the operations in the API reference.
  • Catalog — stores product prices in minor units.
  • Cart — calculates totals in minor units.
  • Orders — records order and line totals.
  • Payments — implements the provider contract.

Type to search…

↑↓ navigate↵ selectEsc close