@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
Script-tag installation
Without a bundler, load the IIFE bundle with a classic script tag. It exposeswindow.Lynq.
@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 beforemount() so you cannot miss an early event.
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 withappearance. 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. Calldestroy() 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, butCheckout 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:
clientSecret stable for the lifetime of that component.