Background
⌘K

Double-Sided Incentives with Coupon Codes

Boost affiliate performance and customer conversion with discount codes that automatically apply to referred customers — using program-wide or unique affiliate coupons

Silvestro
Written by Silvestro
Updated more than a week ago

Double-sided incentives create a win-win situation where affiliates earn commissions while their referred customers automatically receive discount codes. This powerful feature increases both affiliate motivation and customer conversion rates by providing immediate value to every referred visitor.

Affonso supports two types of coupon codes for double-sided incentives:

  • Program-Wide Coupons: A single coupon code shared across all affiliates in a program. Every referred customer sees the same discount.
  • Unique Affiliate Coupons: Individual coupon codes per affiliate. Each affiliate can have their own personalized discount code(s), enabling more targeted promotions and better tracking.

You can use either type — or both together. When a customer arrives via an affiliate referral link, the Affonso tracking pixel automatically makes both the program-wide coupon and the affiliate's unique coupons available in the affonso_data cookie.

Option 1: Program-Wide Coupon

Program-wide coupons are the simplest way to get started. One coupon code applies to all affiliates in the program.

1

Create Program-Wide Coupon

  1. Navigate to your Affiliate Program Settings
  2. Scroll down to the "Program-Wide Coupon Code" section
  3. Click "Create Program Coupon"
  4. Configure your coupon:
    • Discount Type: Choose percentage or fixed amount
    • Discount Value: Set your discount amount (e.g., 20% or $10)
    • Duration: Select "once", "forever", or "repeating"
    • Coupon Code: Enter a memorable code (e.g., "WELCOME20")
  5. Click "Create Coupon" to generate it across all your connected payment providers

The coupon will be automatically created in Stripe, DODO, and Polar (depending on your integrations) and becomes immediately available to all customers.

2

Access the Coupon in Your Checkout

// Get the program-wide discount
const discount = window.Affonso.getDiscount();

if (discount) {
  console.log(discount.promoCode);  // e.g., "WELCOME20"
  console.log(discount.couponId);   // Payment provider coupon ID
  console.log(discount.amount);     // e.g., 20
  console.log(discount.type);       // "percentage" or "fixed"
}

Option 2: Unique Affiliate Coupons

Unique affiliate coupons give each affiliate their own personalized discount code. This is great for influencer partnerships, brand ambassadors, or any scenario where you want affiliates to promote their own codes.

1

Create Unique Coupons for Affiliates

You can create unique coupon codes for individual affiliates through:

  • Dashboard: Navigate to the affiliate's profile and create a coupon code in the "Coupon Codes" section
  • API: Use the Affonso API to create coupons programmatically via POST /v1/coupons
  • Self-Service: Enable self-service coupon creation to let affiliates create their own codes from the affiliate portal
2

Access Affiliate Coupons in Your Checkout

When a customer arrives via an affiliate's referral link, all of that affiliate's unique coupons are available:

// Get all unique coupons for this affiliate
const coupons = window.Affonso.getAffiliateCoupons(); // Returns array

if (coupons.length > 0) {
  const coupon = coupons[0]; // Most recently created coupon
  console.log(coupon.promoCode);  // e.g., "JOHN20"
  console.log(coupon.couponId);   // Payment provider coupon ID
  console.log(coupon.amount);     // e.g., 20
  console.log(coupon.type);       // "percentage" or "fixed"
}

Using Both Together

You can combine both coupon types. A common pattern is to prefer the affiliate's unique coupon when available, and fall back to the program-wide coupon:

// Prefer affiliate's unique coupon, fall back to program-wide
const affiliateCoupons = window.Affonso.getAffiliateCoupons();
const programDiscount = window.Affonso.getDiscount();

const coupon = affiliateCoupons.length > 0
  ? affiliateCoupons[0]  // Use affiliate's unique coupon
  : programDiscount;      // Fall back to program-wide

if (coupon) {
  fetch('/api/checkout', {
    method: 'POST',
    body: JSON.stringify({
      couponId: coupon.couponId,
      // ... your other checkout data
    })
  });
}

For a complete implementation guide on auto-applying coupons at checkout, see Auto-Apply Affiliate Coupons at Checkout.

How It Works

  1. Customer clicks affiliate link with referral parameter (e.g., ?via=affiliate123)
  2. Affonso tracking pixel automatically detects the referral and fetches coupon data
  3. Coupon information is stored in the affonso_data cookie — both program-wide and affiliate-specific coupons
  4. Your checkout flow retrieves the coupon and applies it during payment
  5. Customer gets discount while affiliate earns commission on the sale

Access Methods

You can access coupon data using these JavaScript methods:

// Get program-wide discount (one per affiliate program)
const discount = window.Affonso.getDiscount(); // Returns discount object or null

// Get unique affiliate coupons (all coupons for this specific affiliate)
const coupons = window.Affonso.getAffiliateCoupons(); // Returns array (empty if none)

// Get all data
const data = window.Affonso.getData();

// Example discount/coupon object:
// {
//   amount: 20,
//   type: "percentage",
//   maxDuration: "once",
//   couponId: "stripe_coupon_id",
//   promoCode: "WELCOME20"
// }

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.