Skip to content

Install

Match payments to affiliates

Choose how your customers pay so EzyPromote can match each payment to the affiliate click that came before it, with the exact steps for each option.

Why this choice matters

The click happens on your website. The payment happens later, in Stripe or your billing system. To credit the right affiliate, the payment has to carry something that points back to the click. In setup step 3, How your customers pay sets how that happens. Pick one: you only need one.

Which one to pick

How you sell Pick
Stripe Payment Links, buy buttons or a pricing table on your pages, no code Stripe payment links or pricing tables
Your own code creates a Stripe Checkout Session Stripe Checkout started by your code
Customers create an account first (a free trial or free plan) and pay later, or pay outside Checkout Sign up first, pay later
Paddle, Chargebee, your own billing, or anything that isn’t Stripe Another billing system

EzyPromote preselects one for you: payment links for sites built on Webflow, Wix, Squarespace, Framer or WordPress, the billing API when you connected another billing system, and Checkout otherwise. Whichever you choose, the test purchase in the last step checks it.

The code on this page is an example of the change, not code to paste as it is: your checkout and signup code will look different. Put the same values in the same place in your own code. Or let your AI do it: setup gives you a ready-made prompt for each option that needs code. See Install with an AI assistant.

No code. Your website tag adds the visitor’s click to each Stripe payment link, buy button and pricing table on your pages. It uses Stripe’s client_reference_id field, with a value that starts with ep1_.

  1. Choose Stripe payment links or pricing tables.
  2. Copy your website tag again and replace the old one on your site. The new tag has data-stripe-links, which turns this on.
  3. Keep your Stripe links on pages that have the tag.
  4. Leave client_reference_id empty on those links. EzyPromote can’t add the click to a link that already has one, and never writes over yours.

If your payment links use your own domain, such as pay.yourstore.com, set data-stripe-links="pay.yourstore.com" on the tag.

This option needs the website tag. If you record clicks only on your server, keep the tag on your pages as well.

Stripe Checkout started by your code

Your developer adds the click to the Checkout Session’s metadata as ep_click. About three lines of code. The checkoutClickToken helper from EzyPromote’s server SDK reads the visitor’s clicks from their cookies. Track clicks and signups on your server explains how to install it.

// app/api/checkout/route.ts (Next.js)
import { checkoutClickToken } from '@ezypromote/node/referrals'

export async function POST(request: Request) {
  const epClick = checkoutClickToken(request)
  const metadata = epClick ? { ep_click: epClick } : {}
  const session = await stripe.checkout.sessions.create({
    /* your items, mode and URLs */
    metadata,
  })
  return Response.json({ url: session.url })
}

The app shows the same code for Astro, TanStack Start and Node.

  • Subscriptions: also pass subscription_data: { metadata }. Use it in subscription mode only: Stripe refuses it in payment mode.
  • Creating customers yourself: put the same metadata on stripe.customers.create.
  • Another language: add data-ep-signup to the form that starts checkout. The tag then adds a hidden ep_click field, and your server copies it into the session’s metadata:
<?php
// The form that starts checkout has data-ep-signup, so it posts an ep_click field
$metadata = empty($_POST['ep_click']) ? [] : ['ep_click' => $_POST['ep_click']];
$session = $stripe->checkout->sessions->create([/* your items, mode and URLs */ 'metadata' => $metadata]);

Sign up first, pay later

Your server tells EzyPromote about each new signup, and EzyPromote matches it to the affiliate’s click. This is called binding. Later payments follow your user ID, so they can come weeks later, from a trial, or from outside Checkout.

  1. Choose Sign up first, pay later.
  2. Add the binding call to your signup code. See Track clicks and signups on your server.
  3. Put the same user ID in Stripe as ep_user_id, on the Customer or the Checkout Session:
await stripe.customers.create({
  email: user.email,
  metadata: { ep_user_id: user.id },
})

Another billing system

Your server sends each payment to EzyPromote’s billing API. To credit the affiliate, send the visitor’s ep_click value as referral_hint, or bind the signup first and send your user ID as user_id. See Use another billing system.

The Stripe fields EzyPromote reads

Field Where EzyPromote looks What it holds
ep_click The payment’s metadata (Checkout Session, subscription, invoice, PaymentIntent or charge), then the Customer’s The visitor’s clicks, from checkoutClickToken or the form field
client_reference_id The Checkout Session of a payment link or pricing table The click reference the tag adds. Only values that start with ep1_ are read.
ep_user_id The same places as ep_click Your user ID, the one you sent when binding the signup. user_id also works.
ep_deal The subscription, then the invoice, then the Checkout Session, then the price. Never the Customer. A commission rate slug
ep_product The same places as ep_deal, then the Stripe product (this needs the optional Products permission) A product slug

When both ep_click and an ep1_ reference are present, ep_click wins.

When commission rates and products matter

You can skip both if you sell one product at one commission rate.

  • Commission rates. A campaign can have several rates, such as “Monthly plan: 20%” and “Yearly plan: 30%”. Each rate has a slug: on the campaign’s Commission tab, edit the rate and open Advanced: checkout metadata. Send the slug as ep_deal and the payment earns that rate. With no slug, or a slug the campaign doesn’t have, it earns the campaign’s default rate.
  • Products. If you sell more than one product, each has a slug on the Products page, such as pro. Send it as ep_product so the sale counts for that product. A slug that names no product is ignored and EzyPromote uses your Stripe product mapping instead.

To avoid code changes, set ep_deal and ep_product once in the metadata of a Stripe price or product, instead of on every checkout.

Next: Track clicks and signups on your server if you picked “Sign up first, pay later”, Use another billing system if you don’t use Stripe, or else Test a purchase and go live.