Background
⌘K

Double-Sided Incentives with Program-Wide Coupons

Boost affiliate performance and customer conversion with program-wide discount codes that automatically apply to referred customers

Silvestro
Written by Silvestro
Updated more than a month 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.

When you create a program-wide coupon, it automatically becomes available to all customers who visit your site through any affiliate referral link, creating seamless incentives without additional setup per affiliate.

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

Add Coupon Logic to Checkout Flow

To automatically apply program-wide coupons, you need to retrieve the couponId from the affonso_data cookie and pass it to your payment provider during checkout session creation. The cookie contains the discount information that was set when the customer arrived via an affiliate referral link.

Your frontend checkout flow should extract this data and send it to your backend, which then includes the coupon ID in the payment provider's checkout session API call.

Implementation

// Frontend: Get discount data  
const discount = window.Affonso.getDiscount(); // Single program-wide discount

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

Backend Integration

Pass the couponId to your payment provider's checkout session:

  • Stripe: discounts: [{ coupon: couponId }] - API Docs
  • DODO: discount_id: couponId - API Docs
  • Creem: discount_code: promoCode - API Docs

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 program-wide coupon data
  3. Coupon information is stored in the affonso_data cookie for easy access
  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 the coupon data using these JavaScript methods:

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

// Get all data (includes discount and future extensions)
const data = window.Affonso.getData();

// Example discount 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.