How to Set Up Affiliate Coupon Tracking with Stripe
Most affiliate programs rely on tracking links: an affiliate shares a unique URL, the visitor clicks it, a cookie is dropped, and when that visitor eventually purchases, the sale is attributed to the affiliate. This works well in many cases — but it has a significant blind spot.
What happens when a customer hears about your product on a podcast, types your URL directly into their browser, and subscribes without ever clicking an affiliate link? The affiliate who drove that sale gets no credit. What about customers who switch devices, clear cookies, or use a browser that blocks third-party tracking? Same problem.
Coupon-based attribution solves this. Instead of relying on cookies and click tracking, each affiliate gets a unique coupon or promo code. When a customer enters that code at checkout, the sale is attributed to the affiliate — regardless of how they arrived at your site. No cookies needed.
This guide walks you through setting up affiliate coupon tracking with Stripe using Refgrow, from creating the coupons to understanding when coupon attribution is the right choice for your program.
How Coupon Attribution Works
The flow is straightforward:
- You create a coupon in Stripe — typically a percentage or fixed-amount discount.
- You generate a promotion code for that coupon — this is the customer-facing code (e.g., "PARTNER20" or "SARAH15").
- You assign the promotion code to an affiliate in Refgrow — linking the code to a specific affiliate.
- A customer uses the code at checkout — Stripe applies the discount and records which promotion code was used.
- Stripe sends a webhook to Refgrow — the
checkout.session.completedorinvoice.paidevent includes the promotion code details. - Refgrow matches the promotion code to the affiliate — the sale is attributed and the commission is calculated.
The key advantage: attribution happens at the Stripe level, not the browser level. It doesn't matter if the customer clicked a link, typed your URL manually, or came from a Google search. If they use the coupon code, the affiliate gets credit.
Step 1: Create a Coupon in Stripe
First, create the base coupon in your Stripe dashboard. This defines the discount itself.
- Log in to your Stripe Dashboard.
- Navigate to Products → Coupons.
- Click + New.
- Configure the coupon:
- Type: Percentage off or fixed amount
- Discount: The discount value (e.g., 20%)
- Duration: Once, repeating, or forever. "Once" applies only to the first invoice. "Repeating" lets you specify how many months the discount lasts. "Forever" applies to every invoice for the life of the subscription.
- Redemption limits: Optionally limit total redemptions or set an expiration date.
- Click Create coupon.
Choosing the Right Discount
The discount you offer through affiliate coupons should balance two things: it needs to be attractive enough for customers to use (and for affiliates to promote), but not so large that it erodes your margins after you pay the affiliate commission.
A common setup for SaaS:
- 10-20% discount on the first payment or first 3 months
- 20-30% affiliate commission on the (discounted) subscription revenue
Do the math: if your plan is $100/month, a 20% coupon brings it to $80. A 25% commission on that means you pay $20 to the affiliate. Your net on that first month is $60 instead of $100 — but you acquired a customer without ad spend, and subsequent months generate full revenue (if the coupon is "once" duration) with the affiliate commission as your only cost.
Step 2: Create Promotion Codes in Stripe
Coupons and promotion codes are different things in Stripe. A coupon defines the discount. A promotion code is the customer-facing string that applies the coupon. One coupon can have multiple promotion codes — this is exactly what you want for affiliate tracking, because each affiliate gets their own code tied to the same discount.
- In Stripe, go to the coupon you just created.
- Under Promotion codes, click + New promotion code.
- Enter a code string. This is what the customer will type at checkout. Make it memorable and relevant to the affiliate:
SARAH20— affiliate's name + discount amountTECHBLOG20— affiliate's brand + discount amountPARTNER-ACME— generic prefix + affiliate identifier
- Configure restrictions if needed:
- First-time customers only: Prevents existing customers from using affiliate codes to get discounts on renewals.
- Minimum order amount: Useful if you have multiple pricing tiers.
- Maximum redemptions: Cap the number of times the code can be used.
- Expiration date: For time-limited campaigns.
- Click Create promotion code.
Repeat this for each affiliate who needs a unique code. If you have 10 affiliates, you'll create 10 promotion codes, all linked to the same coupon.
Step 3: Connect Stripe to Refgrow
If you haven't already connected your Stripe account to Refgrow, here's the setup:
- Log in to your Refgrow dashboard.
- Go to your project settings.
- Under Payment Provider, select Stripe.
- Enter your Stripe Secret Key and Webhook Signing Secret.
- Refgrow will automatically configure the webhook endpoint in your Stripe account, listening for the relevant events:
checkout.session.completed,invoice.paid,customer.subscription.created,customer.subscription.updated, andcustomer.subscription.deleted.
Once connected, Refgrow receives every relevant Stripe event in real time. This is the foundation for both link-based and coupon-based attribution.
Step 4: Assign Coupon Codes to Affiliates in Refgrow
Now link each Stripe promotion code to its corresponding affiliate in Refgrow.
- In your Refgrow dashboard, go to Affiliates.
- Click on the affiliate you want to assign a coupon to.
- In the affiliate details panel, find the Coupon Code field.
- Enter the exact promotion code string you created in Stripe (e.g.,
SARAH20). - Save.
That's it for the setup. When a customer uses SARAH20 at checkout, Stripe includes the promotion code in the webhook payload, and Refgrow automatically attributes the sale to Sarah.
Step 5: Enable Coupon Codes on Your Stripe Checkout
An important step that's easy to miss: your Stripe Checkout session must allow promotion codes. If you're using Stripe Checkout (the hosted payment page), you need to set allow_promotion_codes: true when creating the session.
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [{
price: 'price_xxx',
quantity: 1,
}],
allow_promotion_codes: true, // This enables the promo code field
success_url: 'https://yourapp.com/success',
cancel_url: 'https://yourapp.com/pricing',
});
Without this flag, customers won't see a field to enter promotion codes on the checkout page. If you're using Stripe Elements or a custom payment form, you'll need to handle promotion code input in your own UI and apply it via the Stripe API.
How Refgrow's Attribution Priority Works
In practice, a customer might interact with both a tracking link and a coupon code. For example, they click an affiliate's referral link (setting a cookie), and then also enter a coupon code at checkout. What happens?
Refgrow uses a clear attribution priority for Stripe events:
- Stripe coupon/promotion code match — highest priority
- Session metadata referral code — set via
metadata.referral_code - Client reference ID — set via
client_reference_id - Subscription metadata — referral code stored on the subscription
- Email fallback — matches the customer email against previous referral attributions
Coupon attribution takes the highest priority because it represents the most explicit signal: the customer actively typed in a specific affiliate's code. This is a deliberate choice, not an accident of cookie tracking.
This means if a customer clicks Affiliate A's link but enters Affiliate B's coupon code, Affiliate B gets the attribution. The logic is that the coupon code represents the stronger intent signal — the customer made a conscious decision to use that code.
Link Attribution vs. Coupon Attribution vs. Both
Most programs should use both methods. They complement each other rather than compete. Here's when each method shines.
When Link Attribution Works Best
- Content-heavy affiliates: Bloggers and review sites who drive traffic through articles. Readers click through from the content to your site — the link does the tracking naturally.
- Social media shares: Tweets, LinkedIn posts, Facebook shares — all link-based.
- Email campaigns: Newsletter authors who include your link in their emails.
- Simple user experience: The customer doesn't need to remember or enter anything. The tracking is invisible.
When Coupon Attribution Works Best
- Podcast and video affiliates: "Use code SARAH20 for 20% off" is a natural call-to-action in audio and video content where clickable links aren't practical.
- Offline and word-of-mouth: When affiliates tell people about your product in person, at events, or in private messages — no link is involved.
- Cookie-resistant environments: Safari's Intelligent Tracking Prevention, Firefox's Enhanced Tracking Protection, and privacy-focused browsers aggressively block third-party cookies. Coupon codes work regardless.
- Cross-device journeys: Customer hears about you on mobile but signs up on desktop. The cookie from the mobile click doesn't transfer. A coupon code does.
- Incentivized conversion: The discount itself motivates the purchase. Affiliates have a concrete offer to promote, not just a generic "check this out" pitch.
When to Use Both
The best approach for most SaaS affiliate programs is to give each affiliate both a referral link and a coupon code. The affiliate chooses what to use based on the context:
- Writing a blog post? Include the referral link.
- Recording a YouTube video? Mention the coupon code verbally and put the link in the description.
- Posting on social media? Use the link. But if someone asks in the comments, share the coupon code.
- Speaking at a conference? Tell the audience the coupon code.
In Refgrow, each affiliate can have both a referral link and a coupon code simultaneously. If both are used on the same purchase (link click + coupon code), the coupon takes priority as described above — but in practice, this double-touch scenario usually means one affiliate drove the entire journey, so it resolves correctly.
Pros and Cons of Coupon-Based Attribution
Pros
| Advantage | Details |
|---|---|
| Cookie-independent | Works even when cookies are blocked, cleared, or expired. No dependency on browser tracking. |
| Cross-device tracking | Customer can hear about the code on mobile and use it on desktop. No cookie transfer needed. |
| Works for audio/video | Podcasters and YouTubers can verbally share a code. Impossible with link-only attribution. |
| Explicit attribution | The customer deliberately enters the code — this is a strong, unambiguous signal. |
| Conversion incentive | The discount gives the customer a reason to buy now, increasing conversion rates. |
| Fraud-resistant | Harder to game than click-based attribution. Cookie stuffing doesn't work with coupons. |
Cons
| Disadvantage | Details |
|---|---|
| Requires a discount | You're giving up revenue on each coupon-attributed sale. Link attribution doesn't require any discount. |
| Code sharing/leaking | Coupon codes can end up on discount aggregator sites (RetailMeNot, Honey). Mitigation: use "first-time customers only" restrictions and monitor usage. |
| Customer friction | The customer must remember and type the code. Some will forget, meaning the affiliate loses attribution on sales they influenced. |
| Discount expectations | Once customers know coupons exist, some will search for codes before every purchase, conditioning your market to expect discounts. |
| Management overhead | Each affiliate needs a unique code created in Stripe and linked in Refgrow. Manageable at 10-50 affiliates, but consider automation at scale. |
Best Practices for Coupon-Based Affiliate Tracking
1. Use Consistent Naming Conventions
Establish a naming pattern for promotion codes and stick to it. This makes management easier as your program grows:
AFFILIATE-NAME20— simple and recognizableREF-[AFFILIATE]-[DISCOUNT]— e.g.,REF-SARAH-20- Avoid codes that are easy to guess (don't use
DISCOUNT20orSAVE20— these are generic and may be shared widely)
2. Restrict to First-Time Customers
Always enable the "first-time customers only" restriction on your promotion codes. This prevents existing customers from using affiliate codes to discount their own renewals — a common source of commission leakage.
3. Monitor for Code Leaking
Periodically search Google for your affiliate coupon codes. If they show up on coupon aggregator sites, you have two options: rotate the code (create a new one and deactivate the leaked one) or accept it as additional exposure. The right choice depends on your margins and the volume of "unearned" redemptions.
4. Set Reasonable Expiration Dates
Promotion codes with no expiration date can circulate indefinitely. Consider setting codes to expire every quarter and issuing fresh ones. This gives you a natural touchpoint to re-engage affiliates and keeps leaked codes from accumulating.
5. Track Both Methods Separately
In Refgrow, you can see whether each conversion was attributed via link or coupon. Review this data regularly. If most conversions come through coupons, your affiliates may be primarily promoting through channels where links don't work well (podcasts, video, word-of-mouth). Lean into that by creating more resources for those channels.
Troubleshooting Common Issues
Coupon Code Used but No Attribution
If a customer uses a coupon code but the sale isn't attributed to an affiliate, check these things:
- Is the promotion code linked to an affiliate in Refgrow? The code must be assigned in the affiliate's Refgrow profile. If it only exists in Stripe but isn't linked in Refgrow, there's nothing to match against.
- Is the code an exact match? Refgrow matches the Stripe promotion code string exactly. Ensure the code in Refgrow matches what's in Stripe, including capitalization.
- Is the webhook connected? Check your Stripe webhook logs to confirm events are being delivered to your Refgrow endpoint successfully.
Customer Applied Coupon After Initial Checkout
If a customer subscribes without a coupon and later asks to apply one, the standard Stripe Checkout flow won't capture this. You'd need to manually apply the coupon to their subscription in Stripe and manually attribute the sale in Refgrow.
Multiple Affiliates Want the Same Code
Two affiliates both want the code "SAVE20." Since each promotion code in Stripe must be unique, you'll need to differentiate. Use their name or brand: "SARAH20" and "MARK20" both apply the same 20% discount but are distinct codes tied to different affiliates.
Set Up Coupon Tracking in Minutes
Refgrow supports Stripe coupon/promo code attribution out of the box. Connect your Stripe account, assign coupon codes to affiliates, and start tracking sales automatically — alongside link-based attribution, email matching, and more. Works with Stripe, LemonSqueezy, Paddle, and Polar.
Start Free Trial