Open MercatoDocsSearch docsAPI reference

Framework

Checkout

A support rep can send a one-off payment link without creating a full sales order. Configure the provider, create the pay link and follow the transaction back into the admin. The successful browser return and the recorded payment status are worth checking separately.

The checkout module lives in the standalone @open-mercato/checkout package and adds Phase A pay links to Open Mercato. It is intentionally decoupled from sales: merchants can collect one-off payments through shareable URLs without creating quotes or orders.

For day-to-day operator workflow, see the Checkout Pay Links user guide.

What Phase A delivers

Enable the module

Add the package and register it in the app module list:

// apps/mercato/src/modules.ts
{ id: 'checkout', from: '@open-mercato/checkout' }

After enabling the module, run migrations and yarn generate when you add or modify auto-discovered module files.

Admin workflow

Templates

Use templates when you repeat the same payment setup:

Create a pay link directly or from a template. The link form supports:

On the create-link form itself, users can also search and apply a template as a starting point without leaving the page.

Links start in draft, can be previewed, and become public only after they are published.

Transactions

Transactions are read-only in admin. Users with checkout.view can inspect status and gateway correlation. Users also need checkout.viewPii to see decrypted customer fields.

Public flow

The public flow uses four endpoints:

Password-protected pay links sign a short-lived cookie-backed session. Set AUTH_SECRET or NEXTAUTH_SECRET in the app env when possible. If those are not configured, checkout falls back to JWT_SECRET, then TENANT_DATA_ENCRYPTION_FALLBACK_KEY.

The server remains authoritative for:

POST /submit requires Idempotency-Key to prevent duplicate transactions during client retries.

Protections and security boundaries

Checkout is intentionally customizable at the UI layer, but strict at the integrity layer. The module includes the following protections out of the box.

Publication boundary

Admin access control

Secret handling

Public endpoint hardening

Duplicate-submit protection

Server-authoritative amount validation

Availability and oversell protection

Status reconciliation

Data minimization

Customization boundary

Emails and notifications

Checkout can send:

Checkout uses the Communications Hub system email transport. Omit SYSTEM_EMAIL_PROVIDER or set it to resend for the Resend channel provider, or set SYSTEM_EMAIL_PROVIDER=ses for the Amazon SES channel provider.

Checkout email sender resolution follows the same precedence as the notifications system:

  1. NOTIFICATIONS_EMAIL_FROM
  2. EMAIL_FROM
  3. ADMIN_EMAIL

If only ADMIN_EMAIL is configured, it is used as the sender fallback, so it must be a valid address accepted by your mail provider.

It also emits in-app notifications for:

Extensibility

Checkout exposes stable UMES surfaces for extension without forking the module.

Injection spots

Replacement handles

Customization stops at payment-critical boundaries. Extensions can change layout and presentation, but they must not replace the server-side pricing, consent, password, or transaction-reconciliation rules.

Gateway-provider integration

Checkout relies on the additive provider-descriptor surface from payment_gateways, not on provider-specific code. Gateway packages must publish safe descriptors that expose:

When the selected provider declares requiresPayerFields, the template and link create/update commands reject the save with a 422 field error on gatewayProviderKey (checkout.validation.gatewayProviderKey.payerFieldsNotCollected) unless customer details are collected and each mapped customer field is required: email → email, name → firstName and lastName. Updates validate the merged (stored + submitted) state, so an already-misconfigured link keeps working at payment time but must be fixed on its next save. The editor shows the same rule as an inline warning in the payment section.

Checkout reads these descriptors through the descriptor service and the safe provider endpoints in payment_gateways. Credentials stay owned by the gateway package and its integration records.

Provider-owned browser payment UI is auto-discovered from widgets/payments/client.tsx in each gateway package. Checkout never imports Stripe, PayU, or other provider UI directly; it resolves provider widgets through the shared payment renderer registry using the clientSession returned by the payment gateway layer.

Test the route the payer actually uses

Create a test link with a configured provider. Open it in a separate browser session, check the amount and required payer fields, then follow the payment through the provider's test environment. Verify the resulting transaction in the back office.

Previous: Calendar event types · Next: Communications Hub