Description: Process an affiliate via WP Affiliate Platform after a PMPro checkout.
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
IMPORTANT NOTE: The WP Affiliate Platform folks are maintaining a version of this gist that may have important updates. You can get their version here: https://www.tipsandtricks-hq.com/wordpress-affiliate/paid-memberships-pro-wp-affiliate-plugin-integration-873
Both Paid Memberships Pro (http://wordpress.org/extend/plugins/paid-memberships-pro/) and WP Affiliate Platform (http://www.tipsandtricks-hq.com/wordpress-affiliate/) must be installed and activated.
//process affiliate and save id
$morder = new MemberOrder();
$sale_amt = $morder->total; //TODO - The commission will be calculated based on this amount
$unique_transaction_id = $morder->code; //TODO - The unique transaction ID for reference
$email = $morder->Email; //TODO - Customer email for record