Migrate from Rewardful
If you're currently using Rewardful for your affiliate program and want to switch to Affonso, this guide will walk you through the full migration — from importing your existing data to replacing the tracking integration.
💡 Good news! Affonso has a built-in migration tool that automatically imports your campaigns, commission rules, affiliates, referrals, and commissions from Rewardful. The entire process takes just a few minutes.
Import Your Existing Data
Affonso can automatically import your affiliate data from Rewardful — no CSV exports or manual work needed.
What you'll need
- Your Rewardful API Secret — find it in your Rewardful dashboard under Company Settings → API Keys

How to start the migration
- Go to Settings → Migration in your Affonso dashboard
- Click Migrate next to Rewardful
- Enter your API Secret
- Click Start Migration
The migration runs in the background — you'll see real-time progress in the dialog and receive an email when it's done.
What data is migrated?
The migration imports five types of data:
- Campaigns → Groups — Each Rewardful campaign is created as an affiliate group in Affonso. Affiliates are automatically assigned to the correct group based on their campaign membership.
- Rewards → Incentives — Commission rules (percentage or flat amount, duration, type) are imported as incentives and linked to the corresponding groups.
- Affiliates — Name, email, and payout details (PayPal). Only confirmed affiliates with at least one referral are imported — dormant or pending affiliates are skipped to keep your program clean. If an affiliate has customized rewards that differ from their campaign, individual overrides are created automatically.
- Referrals — Name, email, customer ID, and status. Linked to the correct affiliate automatically.
- Commissions — Sale amounts, commission earnings, currency, and their status (pending, approved, paid, etc.).
💡 Safe to re-run. The migration is idempotent — if you run it again, existing records will be skipped. No duplicates will be created.
Replace the Tracking Script
Current Rewardful Script (Remove This)
<!-- Remove this Rewardful script -->
<script
async
src="https://r.wdfl.co/rw.js"
data-rewardful="YOUR-REWARDFUL-ID"
></script>New Affonso Script (Add This)
<!-- Add this Affonso script instead -->
<script
async
defer
src="https://cdn.affonso.io/js/pixel.min.js"
data-affonso="YOUR_PUBLIC_PROGRAM_ID"
data-cookie_duration="YOUR_COOKIE_DURATION"
></script>- Replace
YOUR_PUBLIC_PROGRAM_IDwith your program ID from the Affonso dashboard - Set
YOUR_COOKIE_DURATIONto how many days the tracking should persist
🍪 Need GDPR/Cookie Consent compliance? Add
data-requires-consent="true"to the script above and follow our GDPR integration guide for privacy-first tracking.
Where to add it: Just like with Rewardful, 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.
Update Referral Data Collection
How Rewardful Works (Current)
Rewardful provides referral data via a JavaScript API and stores it in a cookie:
// Rewardful approach
rewardful('ready', function() {
const referralId = Rewardful.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 Rewardful
// Client-side approach (similar to Rewardful)
const referralId = window.affonso_referral || '';Option 2: Server-Side (Cookie) - More Secure
// 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 Rewardful.referral, you can easily switch to window.affonso_referral or the affonso_referral cookie with minimal changes. We recommend the server-side cookie approach for better security.
Update Payment Provider Integration
The core principle is simple: replace 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 (Rewardful):
metadata: {
referral: Rewardful.referral, // ❌ Remove this
}After (Affonso):
metadata: {
affonso_referral: affonsoReferral, // ✅ Add this line
}Stripe Example (Detailed)
Current Rewardful Integration
// Old Rewardful way - REPLACE THIS
rewardful('ready', function() {
const session = await stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
metadata: {
referral: Rewardful.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
Optional - Track User Signups
While Rewardful 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:
// Simple: pass the user's email
window.Affonso.signup(userEmail);
// Advanced: pass an options object
window.Affonso.signup({
email: userEmail, // optional
externalUserId: userId, // optional
name: userName // optional
});At least one of email or externalUserId is required when using the object format.
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
- Visit your site with
?atp=test(Affonso's test affiliate parameter) - Check browser DevTools → Application → Cookies → look for
affonso_referral - The cookie should contain a value like
cmdhq6ayf...
2. Test Stripe Integration
- Trigger your checkout flow locally with the test referral
- Check your server logs/terminal - the Stripe session should show:
metadata: { affonso_referral: "cmdhq6ayf..." } - 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
- Import data from Rewardful — Use the automatic migration tool in Settings (campaigns, rewards, affiliates, referrals, commissions)
- Replace tracking script — Remove Rewardful script, add Affonso script
- Choose referral data method — Client-side (
window.affonso_referral) OR server-side (cookie) - Update payment provider metadata — Change
referraltoaffonso_referral - Connect payment provider to Affonso dashboard (Stripe, Polar, Creem, or Dodo)
- Test referral tracking with
?atp=testparameter - Test payment integration with server logs or live testing
- Optional: Add signup tracking for better insights
Need Help with Migration?
- Technical Support: hello@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 Rewardful to Affonso smoothly!


