Check What You Owe Your Affiliates Before Payday with AffiliateWP and AI
Every unpaid commission by affiliate, checked against its order, with refunded and too-recent ones flagged before you pay.
Prerequisites
A site connected to WPVibe running AffiliateWP 2.37 or newer (tested on 2.37.1) on WordPress 6.9 or newer, with an administrator account. WooCommerce for the order check. Rejecting a commission needs AffiliateWP's write access on: Affiliates > Tools > AI MCP > Enable MCP Write Access.
My WordPress site runs AffiliateWP and WooCommerce. Before I pay my affiliates, check what I owe. My refund window is [number] days. 1. Run get_ability_info for each AffiliateWP ability this uses: affiliatewp/list-referrals, affiliatewp/get-affiliate and affiliatewp/set-referral-status. If one is not found, stop and tell me this needs AffiliateWP 2.37 or newer on WordPress 6.9 or newer. If affiliatewp/set-referral-status shows meta.mcp.public false, carry on with the report, but tell me you can't reject anything until I switch on Enable MCP Write Access under Affiliates > Tools > AI MCP. 2. Run affiliatewp/list-referrals with status unpaid, number 100, offset 0, then offset 100 and on until you have total of them. 3. Check only referrals with context woocommerce or abilities_api (hand-credited); list the others as not checked. Read their orders in batches with rest_api GET /wc/v3/orders with query include (the reference numbers, comma separated), status any, per_page 100 and fields id,number,status,total,date_created,refunds. For context woocommerce the reference is the order ID. For abilities_api, trust the match only when the referral's description names that order's number (the missed-sale recipe writes "WooCommerce order NUMBER"); otherwise list it as check by hand, since a hand-added reference may not be a WooCommerce order. Flag a referral when its order is refunded, cancelled or failed, when the order has refunds (with the refunded amount; I can reject the commission here, or lower it myself under Affiliates > Referrals), or when no order is found (check by hand). Mark it hold when it is newer than my refund window. 4. For each affiliate, run affiliatewp/get-affiliate for their payment_email (their account email when it is empty). 5. Show me, per affiliate: name, payment email, the total to pay now (referrals not flagged and older than my refund window), the total on hold, and each flagged referral with its id, amount, order number, order status and why. Add the grand totals in the store currency (hand-added referrals show no currency). Change nothing yet. 6. Wait for my yes on which flagged referrals to reject. For each, run affiliatewp/set-referral-status with referral_id and status rejected. Never set any referral to paid, and never change an amount: I pay through Affiliates > Payouts, which records the payout. 7. Report what you rejected (with the previous status from each response), then run affiliatewp/list-referrals with status unpaid again and confirm the new total and the final amount to pay each affiliate. To undo a rejection, set the status back to unpaid with the same ability; AffiliateWP may email the affiliate about it again.
Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:
Run the “Check What You Owe Your Affiliates Before Payday with AffiliateWP and AI” recipe from the WPVibe cookbook on my connected site.
Paying affiliates is the moment mistakes cost real money: a commission on an order that was refunded last week, a sale from yesterday still inside your refund window, a payment email that changed. AffiliateWP rejects most fully refunded commissions on its own, but not partial refunds or the ones added by hand.
The AI lists every unpaid commission by affiliate with their payment email, checks each one’s WooCommerce order is still a sale, and flags the refunded, partly refunded, cancelled and too-recent ones. It rejects only the ones you confirm and never marks anything paid.
Pay through AffiliateWP’s Payouts screen afterwards, so each payment is recorded against the referrals it covers. Give the AI your refund window, for example 30 days, and it holds back anything newer.
Outcome
A payday list per affiliate with what to pay, what to hold and what was rejected, ready for the Payouts screen.