[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GXSDR7E4JASDMVYWSPF58R":3,"skill-same:01M6GXSDR7E4JASDMVYWSPF58R":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":41,"repositoryHtmlUrl":42,"repositoryHomepageUrl":6,"ownerHtmlUrl":43,"ownerBlogUrl":44,"ownerDescription":45,"updatedAt":46,"install":47,"resources":60},"01M6GXSDR7E4JASDMVYWSPF58R","calculate-affiliate-and-referral-payouts",null,"Use when affiliates or referrers must be paid. Computes commission on net-of-refund revenue with integer minor units and reserves against later refunds and clawbacks.","jiayaoqijia\u002Fcryptoskill","jiayaoqijia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1453879?v=4","01M6GMYTX7Q7S504VC6E756ENR","YQ","01M6GMYV1QKJ1CC75MTTGT9PR0",81,"MIT","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-calculate-affiliate-and-referral-payouts\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-calculate-affiliate-and-referral-payouts\u002FSKILL.md",[],[20,21,22,23,24,25,26,27,28,29,30,31,32],"calculate","affiliate","calculate affiliate and referral payouts","referral","refunds","use","later","units","revenue","with","refund","when","paid","2026-11-10 10:12:30",false,"---\nname: calculate-affiliate-and-referral-payouts\ndescription: Use when affiliates or referrers must be paid. Computes commission on net-of-refund revenue with integer minor units and reserves against later refunds and clawbacks.\n---\n\n# Calculate affiliate and referral payouts\n\nCommission on gross that later refunds is commission you overpaid. Compute on net-of-refund revenue, hold a clawback reserve, and keep the payout maths in integer minor units.\n\n## Procedure\n\n1. Define the commission base: net revenue actually collected, after refunds, chargebacks and tax, in integer minor units. Gross-of-all is the common trap.\n2. Set the rate as basis points so it stays integer: 20% = 2000 bp. `commission_minor = base_minor * rate_bp \u002F\u002F 10000`.\n3. Handle tiers deliberately: e.g. 2000 bp on the first 100,000 minor per affiliate per month, 1000 bp above. Compute each band separately and sum.\n4. Worked example, base 250000 minor at 2000 bp up to 100000 then 1000 bp:\n   `100000*2000\u002F\u002F10000 + 150000*1000\u002F\u002F10000 = 20000 + 15000 = 35000` minor = USD 350.00.\n5. Apply a clawback window: hold commission on sales that could still refund. `reserve = commission_minor * refund_rate_estimate`; pay the rest.\n6. On a refund inside the window, reverse the matching commission out of the reserve, so a clawback never comes out of a future legitimate payout.\n7. Recurring commissions: pay on each renewal's net revenue, but stop on churn. Model expected payout as `commission_per_period * expected_periods`, not lifetime.\n8. Cap and fraud-check: flag an affiliate whose conversion rate is a statistical outlier and whose customers share a fingerprint; self-referral is the most common abuse.\n9. Report total commission as a customer-acquisition cost line, net of clawbacks, so unit economics include it.\n\n10. Pay on a fixed cadence with a minimum threshold so the payment run cost does not exceed a small affiliate's commission.\n11. Store last-click attribution evidence so a disputed commission is resolved with data, not a support argument.\n12. Reconcile affiliate payouts to the acquisition-cost line in the ledger so CAC includes them.\n13. Claw back on churn inside the warranty window, not just on refund, when the commission is modelled on retention.\n14. Detect click fraud (duplicate fingerprints, abnormal click-to-signup) before paying, not after.\n15. Publish the commission terms and the clawback window so the maths is auditable by the affiliate.\n\n## Pitfalls\n\n- Paying commission on gross and later eating the refund understates CAC by the refund rate.\n- Lifetime-commission promises on a churning product cost more than any single payout shows.\n- Float percentages on many small commissions drift; integer bp arithmetic keeps the totals exact.\n- No clawback reserve means a refund month turns the programme cash-negative.\n- Self-referral and coupon-stacking inflate payouts; cap and flag before paying.\n\n- Paying micro-commissions weekly costs more in transfer fees than the commission itself; batch to a threshold.\n- Without stored attribution evidence, a commission dispute becomes a goodwill payment.\n- Leaving affiliate payouts out of CAC understates acquisition cost and flatters unit economics.\n- Not clawing back on early churn overpays for customers who leave within the warranty window.\n\n## Verification\n\n    python3 -c \"b=250000; c=100000*2000\u002F\u002F10000+150000*1000\u002F\u002F10000; print(c, b-c)\"\n    # 35000 -> commission $350.00 on $2,500.00 net; a 5% reserve leaves 33250 payable\n\nReport: per-affiliate net base, commission by band, clawback reserve, and the net payable for the period.\n","# Calculate affiliate and referral payouts\n\nCommission on gross that later refunds is commission you overpaid. Compute on net-of-refund revenue, hold a clawback reserve, and keep the payout maths in integer minor units.\n\n## Procedure\n\n1. Define the commission base: net revenue actually collected, after refunds, chargebacks and tax, in integer minor units. Gross-of-all is the common trap.\n2. Set the rate as basis points so it stays integer: 20% = 2000 bp. `commission_minor = base_minor * rate_bp \u002F\u002F 10000`.\n3. Handle tiers deliberately: e.g. 2000 bp on the first 100,000 minor per affiliate per month, 1000 bp above. Compute each band separately and sum.\n4. Worked example, base 250000 minor at 2000 bp up to 100000 then 1000 bp:\n   `100000*2000\u002F\u002F10000 + 150000*1000\u002F\u002F10000 = 20000 + 15000 = 35000` minor = USD 350.00.\n5. Apply a clawback window: hold commission on sales that could still refund. `reserve = commission_minor * refund_rate_estimate`; pay the rest.\n6. On a refund inside the window, reverse the matching commission out of the reserve, so a clawback never comes out of a future legitimate payout.\n7. Recurring commissions: pay on each renewal's net revenue, but stop on churn. Model expected payout as `commission_per_period * expected_periods`, not lifetime.\n8. Cap and fraud-check: flag an affiliate whose conversion rate is a statistical outlier and whose customers share a fingerprint; self-referral is the most common abuse.\n9. Report total commission as a customer-acquisition cost line, net of clawbacks, so unit economics include it.\n\n10. Pay on a fixed cadence with a minimum threshold so the payment run cost does not exceed a small affiliate's commission.\n11. Store last-click attribution evidence so a disputed commission is resolved with data, not a support argument.\n12. Reconcile affiliate payouts to the acquisition-cost line in the ledger so CAC includes them.\n13. Claw back on churn inside the warranty window, not just on refund, when the commission is modelled on retention.\n14. Detect click fraud (duplicate fingerprints, abnormal click-to-signup) before paying, not after.\n15. Publish the commission terms and the clawback window so the maths is auditable by the affiliate.\n\n## Pitfalls\n\n- Paying commission on gross and later eating the refund understates CAC by the refund rate.\n- Lifetime-commission promises on a churning product cost more than any single payout shows.\n- Float percentages on many small commissions drift; integer bp arithmetic keeps the totals exact.\n- No clawback reserve means a refund month turns the programme cash-negative.\n- Self-referral and coupon-stacking inflate payouts; cap and flag before paying.\n\n- Paying micro-commissions weekly costs more in transfer fees than the commission itself; batch to a threshold.\n- Without stored attribution evidence, a commission dispute becomes a goodwill payment.\n- Leaving affiliate payouts out of CAC understates acquisition cost and flatters unit economics.\n- Not clawing back on early churn overpays for customers who leave within the warranty window.\n\n## Verification\n\n    python3 -c \"b=250000; c=100000*2000\u002F\u002F10000+150000*1000\u002F\u002F10000; print(c, b-c)\"\n    # 35000 -> commission $350.00 on $2,500.00 net; a 5% reserve leaves 33250 payable\n\nReport: per-affiliate net base, commission by band, clawback reserve, and the net payable for the period.\n",{"name":5,"description":7},"main","3df1d0d67b30ff15236561f8c0f9f06d33f42dfd","skills\u002Fpayments\u002F0xklen-calculate-affiliate-and-referral-payouts",17,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia","https:\u002F\u002Feth2030.com","Hardcore infra. Building @alt-research and applied cryptography.","2026-11-13 02:31:19",{"source":8,"skillName":5,"commands":48,"prompt":58,"zipAvailable":59},[49,52,55],{"tool":50,"command":51},"npx","npx skills add jiayaoqijia\u002Fcryptoskill --skill calculate-affiliate-and-referral-payouts",{"tool":53,"command":54},"bunx","bunx skills add jiayaoqijia\u002Fcryptoskill --skill calculate-affiliate-and-referral-payouts",{"tool":56,"command":57},"pnpm","pnpm dlx skills add jiayaoqijia\u002Fcryptoskill --skill calculate-affiliate-and-referral-payouts","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-calculate-affiliate-and-referral-payouts\u002FSKILL.md",true,[61,65,71],{"path":62,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":16},"LICENSE","许可证",1063,{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"SOURCE.md","REFERENCE","参考文档",366,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-calculate-affiliate-and-referral-payouts\u002FSOURCE.md",{"path":72,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":73,"sourceHtmlUrl":74},"TRUST.auto.yaml",2217,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-calculate-affiliate-and-referral-payouts\u002FTRUST.auto.yaml",[76,104,127,145,158,168],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":33},"01M712C436EQYE43342Q4E7GG1","recipe-performance","Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold\u002Fwarm\u002Fbackground-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout\u002Fpaint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fwallets\u002Fmetamask-official-recipe-performance\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fwallets\u002Fmetamask-official-recipe-performance\u002FSKILL.md",[],[84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103],"performance","recipe performance","recipe","mm","sentry","harness","app","deterministic","recipes","flow","cold","critical","analysis","tasks","react","browser","layout","screen","network","metamask",{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":108,"licenseFileUrl":109,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":33},"01M70XT2F8A5CQZ81JBP98KSW3","mexc-spot-websocket","MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-spot-websocket\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-spot-websocket\u002FSKILL.md",[],[113,114,115,116,117,118,119,120,121,122,123,124,125,126],"mexc spot websocket","spot","websocket","api","workflows","public","listen","streams","depth","keys","for","api keys","maintenance","protobuf",{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":108,"licenseFileUrl":131,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":33},"01M70XT0MBXN3WZY1BKN0CPNKR","mexc-spot-rest","MEXC Spot REST workflows for public data, signed account requests, orders, wallet\u002Fadmin actions, and secure signing without exposing API keys.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-spot-rest\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-spot-rest\u002FSKILL.md",[],[135,114,136,137,138,139,140,124,123,122,141,142,143,118,144,117,116],"mexc spot rest","REST","admin","signing","Wallet","requests","actions","secure","data","orders",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":108,"licenseFileUrl":149,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":33},"01M70XSYSVZ2N0N91XCAR2CAK0","mexc-futures-websocket","MEXC Futures WebSocket workflows for public streams, private account\u002Forder\u002Fposition streams, ping\u002Fpong, subscriptions, and depth maintenance.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-futures-websocket\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fmncrftfrcnm-mexc-futures-websocket\u002FSKILL.md",[],[153,154,115,155,156,125,123,157,121,120,118,117],"mexc futures websocket","futures","position","ping","subscriptions",{"skillNo":159,"name":160,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":161,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":33},"01M6H0ZWHVE5W04WG2DKQE2SQC","0xklen-version-and-refresh-sanctions-lists","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-version-and-refresh-sanctions-lists\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-version-and-refresh-sanctions-lists\u002FSKILL.md",[],[165,166,167],"refresh","0xklen version and refresh sanctions lists","version",{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":172,"sourceHtmlUrl":173,"categories":174,"keywords":175,"publishedAt":33},"01M6H0Z28Q3R8J0S799GJQWXM3","verify-tests-cover-changed-lines","Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-verify-tests-cover-changed-lines\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fpayments\u002F0xklen-verify-tests-cover-changed-lines\u002FSKILL.md",[],[176,177,178,179,180,181,182,25,183,184,185],"tests","cover","verify tests cover changed lines","verify","coverage","pr","exercise","patch","code","share"]