Background
⌘K

Migrate from Tolt to Affonso

Complete guide to migrate your existing Tolt affiliate program integration to Affonso, including Stripe setup and tracking script replacement.

Silvestro
Written by Silvestro
Last updated on September 15, 2025

Migrate from Tolt

If you're currently using Tolt for your affiliate program and want to switch to Affonso, this guide will walk you through the migration process step by step. Since you already have affiliate tracking set up with Tolt, the migration is straightforward - you just need to replace a few key components.

💡 Good news! If you already have Tolt integrated with any payment provider (Stripe, Paddle, etc.), migrating to Affonso requires only minimal code changes. Your existing affiliate program structure can remain largely the same.

Ready to migrate? Let's get your affiliate program running on Affonso in just a few steps:

1

Replace the Tracking Script

Current Tolt Script (Remove This)

<!-- Remove this Tolt script -->
<script 
  async 
  src="https://cdn.tolt.io/tolt.js" 
  data-tolt="YOUR-TOLT-PUBLIC-ID"
></script>

New Affonso Script (Add This)

<!-- Add this Affonso script instead -->
<script
  async
  defer
  src="https://affonso.io/js/pixel.min.js"
  data-affonso="YOUR_PUBLIC_PROGRAM_ID"
  data-cookie_duration="YOUR_COOKIE_DURATION"
></script>

Find your Affonso Program ID →

Where to add it: Just like with Tolt, add this script to the <head> tag on every page of your website (or at least your landing pages) to ensure no referrals are missed.

Installation Guides

Need help installing the script on your specific platform? Check out our detailed installation guides.

2

Update Referral Data Collection

How Tolt Works (Current)

Tolt provides referral data via a global JavaScript variable:

// Tolt approach
const referralId = window.tolt_referral;

How Affonso Works (New)

Affonso provides referral data in two ways - you can choose the approach that fits your existing setup:

Option 1: Client-Side (JavaScript) - Similar to Tolt

// Client-side approach (similar to Tolt)
const referralId = window.affonso_referral || '';
// Server-side approach (recommended for security)

// Next.js 15+ example
import { cookies } from 'next/headers';
const cookieStore = await cookies();
const affonsoReferral = cookieStore.get('affonso_referral')?.value || '';

// Next.js 13-14 example
const cookieStore = cookies();
const affonsoReferral = cookieStore.get('affonso_referral')?.value || '';

// Express.js example
const affonsoReferral = req.cookies.affonso_referral || '';

// PHP example
$affonsoReferral = $_COOKIE['affonso_referral'] ?? '';

💡 Migration Tip: If you're currently using window.tolt_referral client-side, you can easily switch to window.affonso_referral with minimal changes. However, we recommend the server-side cookie approach for better security.

3

Update Payment Provider Integration

The core principle is simple: replace tolt_referral with affonso_referral in your payment provider's metadata. This works with all supported payment providers.

💡 Connect your payment provider: Connect your payment provider to Affonso before migrating.

Migration Pattern (All Payment Providers)

Before (Tolt):

metadata: { 
  tolt_referral: req.body.referral, // ❌ Remove this
}

After (Affonso):

metadata: { 
  affonso_referral: affonsoReferral, // ✅ Add this line
}

Stripe Example (Detailed)

Current Tolt Integration

// Old Tolt way - REPLACE THIS
const session = await stripe.checkout.sessions.create({ 
  success_url: 'https://example.com/success', 
  cancel_url: 'https://example.com/cancel', 
  metadata: { 
    tolt_referral: req.body.referral, // ❌ Remove this
  }, 
  line_items: [ 
    {price: 'price_H5vtDq1fbrJ', quantity: 1}, 
  ], 
  mode: 'subscription', 
});

New Affonso Integration

// New Affonso way - USE THIS
import { cookies } from 'next/headers';

// Get Affonso referral data
const cookieStore = await cookies(); // Next.js 15+
const affonsoReferral = cookieStore.get('affonso_referral')?.value || '';

const session = await stripe.checkout.sessions.create({ 
  success_url: 'https://example.com/success', 
  cancel_url: 'https://example.com/cancel', 
  metadata: { 
    affonso_referral: affonsoReferral, // ✅ Add this line
  }, 
  line_items: [ 
    {price: 'price_H5vtDq1fbrJ', quantity: 1}, 
  ], 
  mode: 'subscription', 
});

Integration Guides for All Payment Providers

Choose your payment provider for detailed integration instructions:

Stripe

Polar

Creem

Dodo

4

Optional - Track User Signups

While Tolt required explicit signup tracking, Affonso can work without it, but we strongly recommend implementing it for better insights.

Add this code after your user registration logic:

// After successful user registration
window.Affonso.signup(userEmail);

Benefits of signup tracking:

  • See which affiliates drive the most registrations
  • Calculate conversion rates from clicks to signups
  • Optimize your funnel based on affiliate performance

Testing Your Migration

1. Test Referral Tracking

  1. Visit your site with ?atp=test (Affonso's test affiliate parameter)
  2. Check browser DevTools → ApplicationCookies → look for affonso_referral
  3. The cookie should contain a value like cmdhq6ayf...

2. Test Stripe Integration

  1. Trigger your checkout flow locally with the test referral
  2. Check your server logs/terminal - the Stripe session should show:
    metadata: { affonso_referral: "cmdhq6ayf..." }
  3. If the metadata appears correctly, you're all set!

3. Live Testing

Note: Use 100% discount codes for live testing without actual payments, or test locally with server logs - Stripe test mode purchases won't appear in Affonso's dashboard.


Migration Checklist

  • Replace tracking script - Remove Tolt script, add Affonso script
  • Choose referral data method - Client-side (window.affonsoReferral) OR server-side (cookie)
  • Update payment provider metadata - Change tolt_referral to affonso_referral
  • Connect payment provider to Affonso dashboard (Stripe, Polar, Creem, or Dodo)
  • Test referral tracking with ?atp=test parameter
  • Test payment integration with server logs or live testing
  • Optional: Add signup tracking for better insights
  • Update affiliate links to use new Affonso format (if needed)
  • Migrate affiliate data (contact support if needed)

Import Your Existing Affiliates

Don't forget to bring your existing affiliates with you! You can easily import your affiliate data from Tolt (or any other platform) using our self-service CSV import feature.

What you can import:

  • Affiliate names and email addresses
  • Custom tracking parameters for their links
  • PayPal payment information
  • Up to 1,000 affiliates per import

📖 Learn how to import affiliate data →


Need Help with Migration?

  • Technical Support: support@affonso.io - We typically respond within 2 hours during business hours
  • Migration Assistance: Our team can help you migrate your existing affiliate data and test the integration
  • Custom Setup: Need help with a complex migration? We offer personalized migration support

Questions about your specific setup? Contact our support team and we'll help you migrate from Tolt to Affonso smoothly!

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.