Affiliate payouts live in a gap between accounting systems. Stripe captures the payment. Your CRM captures the sale. A spreadsheet tries to connect them. By month four, your payout reconciliation drifts 8–12% because commission rates change, currency conversion happens at different times, and tax withholding gets applied selectively. The gap is not a calculation error—it's architectural. This post walks you through building a real payout system on Stripe's API that closes the loop and keeps an audit trail. Why spreadsheets fail at affiliate payouts A typical flow looks like this: a customer pays via Stripe. The order appears in your CRM or order system. A team member—usually the operations person—exports data once a month, applies commission rates (which may have changed), converts currencies at a random daily rate, deducts tax (or forgets to), and emails payment instructions to your accounting team. The failures compound: Currency drift. Stripe settles in USD. Your affiliate in Indonesia wants rupiah. If you convert manually on the 1st of the month, but the customer paid on the 15th, your rate is off by 2–5%. Commission rate changes. You promoted an affiliate in mid-month, raising their rate from 10% to 15%. The spreadsheet has both rates, but which sales fall under which? Version control breaks down. Tax withholding gaps. Malaysia requires 3% withholding on contractor payments. Indonesia requires 5%. Singapore requires zero. A spreadsheet column for "Tax" is rarely audited; it's often left blank or applied inconsistently. Dispute resolution takes weeks. An affiliate claims they were not paid correctly. You dig through email, spreadsheet versions, and Stripe reports. The audit trail is scattered. No integration with accounting. Your payouts live in a spreadsheet. Your general ledger lives in Xero or QuickBooks. The link between them is manual reconciliation—error-prone and time-consuming. Payouts are not a CRM feature or an accounting feature. They are a data pipeline connecting sales, commissions, tax, and bank transfers. The system must live in the platform that owns the payment: Stripe. The four stages of the payout data pipeline A robust payout system has four distinct stages, each with its own data requirements and checkpoints: Stage 1: Sales event capture When a customer pays in Stripe, your system must immediately record: Sale amount (in the currency charged to the customer) Affiliate ID (linked in your order metadata) Commission rate (active on the date of the sale, not the payout date) Sale date (the source of truth for all downstream calculations) Stripe fee (Stripe's charge for processing—deduct this before commission, or after, depending on your terms) Store this in a database, not a spreadsheet. The simplest approach: use Stripe's metadata field to tag each Charge with affiliate_id and campaign_id . Then query Stripe's API for all charges matching that metadata in a given month. Alternatively, listen to Stripe webhooks: charge.succeeded events fire in real time, and you can log them to a database immediately. This is more reliable than manual exports. Stage 2: Commission calculation For each sale, calculate the gross commission: Gross Commission = Sale Amount × Commission Rate Do this per-sale, not per-affiliate-per-month. This matters because commission rates change. If you store the rate in your database alongside each sale, you have an immutable record of what was owed on that date. At the same point, decide on your fee structure: Gross commission = customer pays $100 → 10% commission = $10 to affiliate. Stripe's fee (2.9% + $0.30) is absorbed by you. Net commission = customer pays $100 → 10% of net revenue ($100 − $2.90 − $0.30 = $96.80) = $9.68 to affiliate. The fee is shared. Document which applies. It affects compliance and payment disputes. Stage 3: Tax withholding and deductions This is where most systems break. Withholding tax is not optional in Malaysia, Indonesia, or Singapore—it is a legal requirement. A spreadsheet approach is insufficient because you have no audit trail, and tax authorities can penalize non-compliance. For each affiliate, calculate: Withholding Tax = Gross Commission × Withholding Rate Withholding rates vary by country and affiliate type: Malaysia: 3% on contractor/service provider payments (standard rate; some cases are 5% or 10%) Indonesia: 5% (standard for commissions paid to non-residents); 2% for certain exports Singapore: 0% (no withholding tax on service payments to residents) Store the withholding rate and the affiliate's tax residency status in your database. Then calculate: Net Payout = Gross Commission − Withholding Tax − Any Other Deductions Record the withholding tax amount separately. This is what you will remit to the tax authority each quarter, not what goes to the affiliate. Stage 4: Payout instruction and currency conversion Once you have the net payout, you must convert to the affiliate's local currency and initiate transfer. Use Stripe's API