Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
Affiliate programs live or die by reliable commission payments. Affiliates who don't get paid on time stop promoting your product. PayPal's Payouts API, combined with GrowSurf's referral revenue tracking, lets you build a commission payment system that calculates commissions automatically, batches payments efficiently, and delivers funds to affiliates worldwide with minimal overhead.
This guide covers building an automated affiliate commission payment system using GrowSurf for tracking and PayPal for payments. You'll learn how to calculate percentage-based commissions, handle recurring commissions, batch payments monthly, and maintain compliance with tax reporting requirements.
Plan your affiliate commission model before building the payment system.
Connect your payment system to GrowSurf to track revenue from each referral.
Create logic that calculates commission amounts based on your commission structure.
Process commission payments in batches for efficiency and cost reduction.
Give affiliates visibility into their earnings, pending payments, and payout history.
Set up proper tax reporting for affiliate commission payments.
// Affiliate Commission Payment System
const db = require('./database');
// Calculate commission based on tier
function calculateCommission(amount, referrerTier) {
const commissionRates = {
'bronze': 0.15, // 15%
'silver': 0.20, // 20%
'gold': 0.25, // 25%
'default': 0.15
};
const rate = commissionRates[referrerTier] || commissionRates.default;
const commission = amount * rate;
const maxCommission = 500; // Cap at $500
return Math.min(commission, maxCommission);
}
// Record a pending commission
async function recordCommission(referrerId, referralId, paymentAmount) {
const referrer = await db.affiliates.findById(referrerId);
const commission = calculateCommission(paymentAmount, referrer.tier);
await db.commissions.create({
referrerId: referrerId,
referralId: referralId,
paymentAmount: paymentAmount,
commissionAmount: commission,
commissionRate: referrer.tier,
status: 'pending',
createdAt: new Date()
});
return commission;
}
// Monthly batch payout job
async function processMonthlyPayouts() {
const MINIMUM_PAYOUT = 25.00;
// Get all pending commissions grouped by affiliate
const pendingByAffiliate = await db.commissions.groupByAffiliate({
status: 'pending'
});
const payoutItems = [];
for (const [affiliateId, commissions] of Object.entries(pendingByAffiliate)) {
const totalAmount = commissions.reduce((sum, c) => sum + c.commissionAmount, 0);
if (totalAmount >= MINIMUM_PAYOUT) {
const affiliate = await db.affiliates.findById(affiliateId);
payoutItems.push({
recipient_type: 'EMAIL',
amount: { value: totalAmount.toFixed(2), currency: 'USD' },
receiver: affiliate.paypalEmail,
note: `Affiliate commissions for ${commissions.length} referrals`,
sender_item_id: `aff-${affiliateId}-${Date.now()}`
});
// Mark commissions as processing
await db.commissions.updateMany(
commissions.map(c => c.id),
{ status: 'processing' }
);
}
}
if (payoutItems.length > 0) {
const payout = await sendBatchPayout(payoutItems);
console.log(`Processed ${payoutItems.length} affiliate payouts`);
}
}Hold commissions for 30 days after the referred customer's payment before marking them as payable. This gives time for chargebacks and refunds. If the customer refunds, reverse the commission before it's paid out. This protects your program from paying commissions on refunded transactions.
While standard affiliates wait for the monthly batch, offer instant payouts (or weekly payouts) as a perk for your top-performing affiliates. This exclusive benefit motivates them to keep promoting and creates aspirational incentive for lower-tier affiliates to increase their referral volume.
Before an affiliate's cumulative earnings reach the $600 tax reporting threshold, automatically prompt them to submit W-9 information. Block payouts above $600 until tax documents are on file. This prevents year-end scrambles to collect tax information retroactively.
PayPal Payouts (Mass Pay) is specifically designed for sending money to multiple recipients. It charges a flat fee (2%, capped at $20) and supports batch processing. Regular PayPal payments (peer-to-peer or invoicing) require the recipient to have an invoice or payment request. Payouts is more efficient and appropriate for automated commission payments.
For affiliates in PayPal-restricted countries, offer alternative payment methods: direct bank transfer via Wise (TransferWise), cryptocurrency payouts, or gift card rewards through a service like Tremendous. Detect the affiliate's country during onboarding and present available payment options.
Yes. Store each affiliate's commission rate or tier in your database (or in GrowSurf participant metadata). When calculating commissions, look up their specific rate. You can also use GrowSurf's reward tiers to automatically upgrade affiliates to higher commission rates as they reach referral milestones.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
