Integration Guide for Developers

Four steps to hook your app into Sidekick Stack attribution.

01

Visitors arrive with an attribution cookie

When a buyer clicks an affiliate link, Sidekick Stack sets a cookie on your domain called sidekick_ref. Its value is the affiliate's unique referral code — for example maria482-hedhuntr. The cookie lasts 30 days.

02

Read the cookie on your payment page

Grab the cookie whenever a buyer is about to check out. In a browser environment:

const ref = document.cookie
  .split('; ')
  .find((c) => c.startsWith('sidekick_ref='))
  ?.split('=')[1]

On the server (Node.js / Next.js):

import { cookies } from 'next/headers'

const store = await cookies()
const ref = store.get('sidekick_ref')?.value ?? null
03

Pass the ref into your payment metadata

Attach sidekick_ref when you create the payment so Sidekick Stack can attribute the sale to the correct affiliate.

PayMongo

await paymongo.paymentIntents.create({
  amount: 59900,
  currency: 'PHP',
  metadata: { sidekick_ref: ref ?? '' },
})

Paddle

Paddle.Checkout.open({
  items: [{ priceId: 'pri_...', quantity: 1 }],
  customData: { sidekick_ref: ref ?? '' },
})

Stripe

await stripe.paymentIntents.create({
  amount: 5900,
  currency: 'usd',
  metadata: { sidekick_ref: ref ?? '' },
})

Other providers

If you're using something else (Xendit, a custom backend, etc.), just include sidekick_refanywhere in your webhook payload — we'll also pick it up from a sidekick_ref=… string inside the description field.

04

That's it

Our webhook picks it up automatically, calculates the affiliate commission using your configured rate, records the sale, and pays out on Fridays. You don't need to do anything else.