@lynqpay/checkout-sdk embeds the Lynq-hosted payment form in your page. Your application controls where Checkout appears and how the surrounding page responds; Lynq controls the payment form, authentication, redirects, and its height.
npm installation
Script-tag installation
If you do not use a bundler, load the IIFE bundle with a classic script tag. Pin the exact released version so an unrelated future release cannot change production checkout without your deployment.window.Lynq.
@latest in production.
Create Checkout
Create one instance after your server returns a Payment Intent client secret.Mount Checkout
The mount target may be a CSS selector or anHTMLElement.
onReady fires when the form is visible and ready for customer input.
Checkout automatically resizes the iframe as its hosted content changes. Do not set the iframe height or listen for internal messages yourself.
Lifecycle and cleanup
Only one Lynq Checkout may be mounted on a page at once. Call
destroy() when a component unmounts or the customer leaves the payment step. Create a new instance for the next Payment Intent.
Layout and accessibility
- Give the mount container enough width for your checkout layout; the iframe height is managed automatically.
- Keep a visible page heading that identifies the payment step.
- Show a loading placeholder until
onReadyfires. - Display
onCheckoutErrormessages in an accessible alert region. - Do not place a second interactive payment form over the Checkout iframe.
Server-rendered applications
The package can be imported by an SSR application, butCheckout can only be constructed in a browser. Constructing it while window or document is unavailable throws ConfigError.
For React, construct Checkout inside an effect or client-only component and destroy it in the cleanup function:
clientSecret stable for the lifetime of that component. If it changes, destroy the old instance before creating a new one.
Next, implement Checkout events and outcomes.