Skip to main content
@lynqpay/js embeds the Lynq-hosted payment form in your page. Your application controls where Checkout appears and how the page around it responds; Lynq controls the payment form, authentication, redirects, and its height.

Install

The package is ESM-only and includes TypeScript declarations.

Script-tag installation

Without a bundler, load the IIFE bundle with a classic script tag. It exposes window.Lynq.
Pin the exact version, never @latest, so a new release cannot change your production checkout. Keep the integrity attribute: the browser refuses to run the file if the CDN serves anything other than the published release. Each version has its own hash, listed in the release notes.

Mount Checkout

Create one instance after your server returns a Payment Intent client secret. Register handlers before mount() so you cannot miss an early event.
The mount target is a CSS selector or an HTMLElement. Checkout inserts an iframe and resizes it as its content changes, so do not set its height yourself.

Handle events

Payment results

A declined payment is a result, not a Checkout error. Authentication challenges and wallet redirects happen inside Checkout and never appear as results. See the Lynq.js reference for exact payloads and Errors for each error code.

Customize the appearance

Match Checkout to your site with appearance. Every field is optional; unset fields keep the theme’s own value.
Colours must be hex values such as #2563eb or #26e. An invalid or unknown entry never stops Checkout: it is ignored and the theme’s own value applies. With a pk_test_… key the SDK logs a console warning saying why.

Clean up

Only one Checkout may be mounted on a page at once. Call destroy() when the customer leaves the payment step, and create a new instance for the next Payment Intent. unmount() removes Checkout but keeps the instance reusable.

Server-rendered applications

The package can be imported during server rendering, but Checkout can only be constructed in a browser; anywhere else it throws ConfigError. In React, construct it inside an effect and destroy it in the cleanup function:
Keep clientSecret stable for the lifetime of that component.
Last modified on November 11, 2026