I am looking to pay an affiliate a comission when a user they have referred buys credits for the upgrades packages.
I have AFFILIATE_PAYONCE set to ‘no’ in affiliatelite.php
I have a do_action in the successful payment section of paypal.php (which I understand gets sent the paypal ipn data when someone purchases credits via the upgrades dashboard page).
That sends the user_id and amount of credits purchased to my function in the mu-plugins/affiliatelite/plugins/ folder.
I don’t need to worry about recording clicks or adding to the affiliaterefferrers table or editing the affiliatelite options page to have configurable payouts for credits packages (like the supporter options)
I just want to use
do_action(‘affiliate_purchase’, $aff, $amount);
to credit the affiliate who referred the purchaser.
Is there an internal function in the affiliate plugin to determine the affiliate who referred a user by their user_id ?
that way i can set $aff and set $amount as a perecentage of the credits purchased and reward the affiliate.