PlandalfDocsSign inStart free

Affiliates

Track sales from your Stripe account

If you sell with Stripe Payment Links, Stripe Checkout or Stripe invoices outside Plandalf, Plandalf can read those payments from your Stripe account and credit the partner who sent each buyer.

Turn it on

  1. Connect Stripe

    Connect the Stripe account that takes the payments under Settings → Payments & Tax Integrations. See Payments.

  2. Switch on Stripe sales

    Go to Affiliates → Settings → General. Under Where customers pay, turn on Also credit sales made directly in Stripe and click Save settings. The switch covers both live and test payments.

  3. Send the partner to Stripe

    Plandalf needs to know which partner each Stripe payment belongs to. Follow the section below for how you sell.

Plandalf credits completed checkouts and paid invoices, and adjusts commissions for refunds, credit notes and disputes. The Status line under the switch shows the last Stripe event Plandalf received.

Tell the Plandalf script to add the partner to links to buy.stripe.com:

<script async src="https://YOUR-ORG.plandalf.dev/js/plandalf-sdk.js"
        data-config-referral-decorate="buy.stripe.com"></script>

<a href="https://buy.stripe.com/YOUR-LINK">Buy now</a>

When a visitor who came through a partner link clicks the payment link, the script adds the partner's referral as Stripe's client_reference_id. It uses a normal link; a payment link opened from code needs the referral added by hand (below). If your links already set client_reference_id, Plandalf leaves it alone, so use Stripe Checkout with metadata instead.

Stripe Checkout from your server

Read the visitor's referral in the browser and send it to the endpoint that creates your Checkout Session. On the server, put it in the session's metadata as plandalf_referral:

const metadata = referralToken ? { plandalf_referral: referralToken } : {};
const { sessions } = stripe.checkout;

const session = await sessions.create({
  mode: "subscription",
  line_items: [{ price: "price_123", quantity: 1 }],
  success_url: "https://example.com/thanks",
  cancel_url: "https://example.com/pricing",
  metadata,
  subscription_data: { metadata }, // for one-off payments: payment_intent_data: { metadata }
});

The referral token starts with rt_. Get it from await plandalf.referral() in the browser (its token), or from the pf_rt cookie the script sets. Putting it on the subscription too means Stripe copies it onto every renewal invoice. See Referrals from code.

Promotion codes

If a partner shares a Stripe promotion code instead of a link, open the partner's page and enter it under Their terms → Stripe promotion code (optional). Plandalf then credits that partner for payments that use the code.

Import past sales

To credit Stripe sales from before you turned this on, use Import past sales under the switch. Choose how many days back (up to 365) and Live or Test, then click Run backfill. It runs straight away. Only payments that carry a partner's referral or promotion code are credited.

Check it works

Open your test link from Affiliates → Setup in a private window, buy through your Stripe test checkout with 4242 4242 4242 4242, then look for the sale under Sales with Test mode on. For subscriptions, check a renewal too before you go live.