Background
⌘K

Debugging Stripe Checkout tracking

How to verify that an affiliate referral made it all the way from the cookie into your Stripe Checkout Session metadata.

Silvestro
Written by Silvestro
Updated more than a week ago

Affonso tracks a Stripe purchase as an affiliate referral when the customer's Checkout Session includes affonso_referral in its metadata. This guide walks through the chain from cookie to commission.

1. Live mode only

Affonso only processes Stripe live-mode webhooks. Test-mode purchases are ignored. For end-to-end testing, use live mode with a 100% off coupon.

Open your site with an affiliate link (e.g. https://yourdomain.com/?atp=affiliate-id) and check DevTools → Application → Cookies. The cookie affonso_referral should exist on your domain.

If it's missing, the tracking script isn't loaded. See the tracking debug checklist.

On your server, read the cookie value when creating the Checkout Session and pass it as metadata:

stripe.checkout.sessions.create({
  // ...
  metadata: {
    affonso_referral: cookieValue,
  },
});

The key must be exactly affonso_referral.

4. Verifying metadata on the Stripe side

  1. Open the customer in your Stripe dashboard.
  2. Scroll to Events and open the Checkout Session completed event.
  3. Confirm metadata.affonso_referral is present and matches the cookie value.

If the metadata is missing, your server isn't reading the cookie or isn't including it in the session.

5. Webhook delivery

Your Stripe webhook endpoint must point at Affonso. Configure it in Tracking & Coupons → Connect. Webhook logs are available in your Affonso dashboard for diagnostics.

Tracking parameters work on any path, not just the homepage. https://yourdomain.com/welcome?atp=affiliate-id and https://yourdomain.com/pricing?atp=affiliate-id both set the cookie correctly.

Was this article helpful?

If you still need help, our support team is here for you.

Contact Support
bg

Ready to Scale Your SaaS?

Affonso is the easiest way to launch your own affiliate program. We take care of the technical stuff, so you can focus on growing your business.