Once your domain is verified (see Pricing and connecting your domain), your site needs one credential and a small amount of markup to start selling article access.
Generate one from your publication's API keys settings. It's server-side only — LinketySplit's API sends no CORS headers, so a key used from browser JavaScript is stopped by the browser before it goes anywhere. Keep it in an environment variable, not in code your site ships to visitors.
npm install @linketysplit/sdkimport { LinketySplit } from '@linketysplit/sdk';
const ls = new LinketySplit({ apiKey: process.env.LS_API_KEY });
const publication = await ls.getPublication();getPublication() is a good first call to make once you've pasted a key in — if it resolves,
your key and your integration are talking to LinketySplit correctly.
Each locked article's page should carry a few linketysplit-* meta tags describing it — title,
excerpt, image, and, if this article should charge something other than your publication's
default price, its own pricing. The SDK renders these for you:
import { createArticleMetaTags } from '@linketysplit/sdk';
const tags = createArticleMetaTags({
title: article.title,
excerpt: article.excerpt,
pricing: { price: 199 } // omit to use your publication's default price
});Drop the returned string into that page's <head>. Nothing needs to call LinketySplit to do
this — it's just markup your own template emits.
The simplest way to sell an article is a plain link built from its own URL — no API call, no credential needed by the visitor:
const url = ls.purchaseLinkUrl('https://yoursite.com/your-article');That link charges whatever the article's own meta tags say (or your publication's default, if it doesn't set one). If you need a price pinned to a specific campaign — a newsletter send, an ad — instead of following the article's live price, create a dedicated link:
const link = await ls.createPurchaseLink({
articleUrl: 'https://yoursite.com/your-article',
pricing: { price: 199 },
name: 'March newsletter'
});
link.url; // https://linketysplit.com/p/…A created purchase link's price is fixed at creation — there's no way to edit it afterward, since an offer already sent to a reader shouldn't change under them. If you need a different price, create a new link.