Morefin Singular

Morefin Singular is the merchant-domain card and wallet checkout for singular checkout sessions.

It renders a web component directly on the merchant domain and authenticates browser calls with a Morefin-issued session access token.

This is useful when you need:

  • card checkout on the merchant site
  • merchant-controlled runtime translations and labels
  • merchant-controlled styling through CSS variables
  • a merchant-domain surface where Google Pay and Apple Pay can be mounted above the card form

Sensitive card data still stays out of the merchant DOM. PAN, expiry, and CVV are collected inside Morefin-hosted secure iframe fields and encrypted in-browser with the singular checkout session public_key.

1. Create the session on your backend

Use POST /api/singular-checkout from your merchant backend and return both session_id and session_access_token to your frontend.

Example response:

{
  "session_id": "session-id",
  "session_access_token": "eyJ...",
  "session_access_token_expires_at": "2026-05-07T12:30:00Z"
}

Do not expose the merchant client_key to the browser for Singular. The component uses Authorization: Bearer <session_access_token> for Singular client API calls.

2. Load the bundle from the Singular CDN

<script
  src="https://cdn.morefin.com/morefin-singular/morefin-singular.js"
  integrity="<release-integrity-value>"
  crossorigin="anonymous"
></script>

Replace <release-integrity-value> with the SHA-384 value published alongside the bundle:

The value starts with sha384- and is generated from the exact bytes of morefin-singular.js. The corresponding morefin-singular-release.json also contains the bundle name and integrity value.

The browser verifies the downloaded bundle against this value before executing it. If the bundle was changed or the integrity value belongs to another release, the browser blocks the script. Keep crossorigin="anonymous" on the script tag, and update the bundle URL and integrity value together when adopting a new release.

For the UAT release deployed on 30 October 2026, use:

<script
  src="https://uat-cdn.morefin.com/morefin-singular/morefin-singular.js?v=20261030-090531"
  integrity="sha384-aunwn3dM4O56kilKpXjqAGNGLRBGzoR5kPAUh2e+3yD9bHDbk6MqECZSKmPTZ7kf"
  crossorigin="anonymous"
></script>

Set the component’s environment attribute to uat when using this UAT bundle. For a later release, retrieve the new integrity value from the UAT link above and update the script URL and integrity value together.

3. Mount the custom element

<morefin-singular
  session-id="session-id"
  session-token="session-access-token"
  locale="en"
  environment="production"
></morefin-singular>

The environment attribute controls which Morefin API origin the component will call internally:

  • production -> https://api.morefin.com
  • uat -> https://uat-api.morefin.com

Merchants do not provide raw API or asset URLs for new integrations.

4. Optional runtime configuration

Use the config property for runtime labels, redirects, theming, and wallet settings.

<script>
  const singular = document.querySelector("morefin-singular");

  singular.config = {
    autoRedirect: true,
    translations: {
      "checkout.submit": "Pay now",
      "checkout.heading": "Complete your purchase"
    },
    theme: {
      "--mf-singular-color-primary": "#0f172a",
      "--mf-singular-color-accent": "#8b5cf6",
      "--mf-singular-radius-lg": "24px"
    },
    googlePay: {
      enabled: true,
      merchantName: "Merchant checkout"
    },
    applePay: {
      enabled: true,
      merchantName: "Merchant checkout",
      countryCode: "US"
    },
    prefill: {
      customer: {
        email: "name@example.com",
        country: "US"
      }
    }
  };
</script>

Public API

Attributes:

  • session-id: required
  • session-token: required Morefin-issued browser token returned as session_access_token
  • locale: optional, defaults to en
  • environment: required for new integrations, one of production or uat

Runtime properties:

  • sessionToken: mirrors the session-token attribute
  • config: runtime labels, redirects, theming, and wallet settings

Methods:

  • validate()
  • submit()
  • reset()

Events:

  • morefin-singular:ready
  • morefin-singular:change
  • morefin-singular:validation-error
  • morefin-singular:google-pay-ready
  • morefin-singular:google-pay-payment-data
  • morefin-singular:apple-pay-ready
  • morefin-singular:apple-pay-payment
  • morefin-singular:success
  • morefin-singular:failure
  • morefin-singular:cancel

Wallets

Singular can render Google Pay and Apple Pay above the card form when the wallet is enabled in runtime config, available for the singular checkout session, and supported by the shopper browser.

Apple Pay runs on the merchant checkout domain. The merchant domain must be registered for Apple Pay and must host Morefin’s public Apple Pay domain association file at:

https://checkout.example.com/.well-known/apple-developer-merchantid-domain-association

On merchant validation, the component calls POST /client/singular-checkout/{id}/apple-pay/merchant-session. On wallet authorization, it calls POST /client/singular-checkout/{id}/apple-pay/authorize unless the merchant provides a custom applePay.processPayment callback.

Recurring payments

Singular supports recurring customer-initiated payments and card verification. After the initial payment is approved, Morefin creates and schedules the subscription and processes future merchant-initiated payments server-side.

See Recurring Payments for session creation, card verification, scheduling, and subscription-management APIs.

Action handling

Singular currently supports provider redirects and form submits returned by the backend. Internal 3DS iframe handling is not supported in Singular yet and will be introduced only when the dedicated backend flow is available.

Example event handling:

<script>
  const singular = document.querySelector("morefin-singular");

  singular.addEventListener("morefin-singular:success", (event) => {
    console.log("payment success", event.detail);
  });

  singular.addEventListener("morefin-singular:failure", (event) => {
    console.log("payment failed", event.detail);
  });
</script>

Table of contents