REST API install
Wire tracking up server-side. Best for custom backends or non-Stripe billing.
If you'd rather not paste a JS snippet or OAuth your Stripe account, you can post events to Partli directly from your backend. This works with any billing system that can fire a webhook on a successful charge — Stripe, LemonSqueezy, Paddle, Chargebee, custom billing, anything.
The flow
- Visitor clicks a partner's
partli.app/r/<slug>link → cookie set automatically. - Visitor lands on your site, signs up, eventually pays.
- Your billing system fires a webhook (e.g.
checkout.session.completed). - Your webhook handler reads the
pref_cidcookie value (you stored it on the user record at signup), and POSTs to Partli.
Step 1 — Capture the click ID at signup
Read the cookie when the user signs up and store it on their record. You only need to do this once per user.
// Inside your signup handler
const clickId = req.cookies.pref_cid;
await db.users.update({
where: { id: newUser.id },
data: { partliClickId: clickId },
});Step 2 — POST the sale when payment lands
// Inside your billing webhook (e.g. Stripe invoice.paid)
const user = await db.users.findUnique({ where: { stripeCustomerId } });
await fetch("https://partli.app/api/track/sale", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PARTLI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
externalId: invoice.id, // unique id, used for dedupe
customerExternalId: stripeCustomerId, // your customer id
amountCents: invoice.amount_paid,
currency: invoice.currency.toUpperCase(),
clickId: user.partliClickId, // attribution
}),
});Pair with the JS snippet for clicks
The REST API path requires you to read the cookie yourself. If you'd like the cookie to be set automatically (and to support
?via=<slug> deep links from partner emails / UTMs), install partli.jstoo — it costs you nothing extra and the two integrations don't conflict.Endpoint reference
- Authentication — API keys + auth header format.
- POST /api/track/sale — full schema, response, and errors.
- POST /api/track/lead — for top-of-funnel events (signups, demos).