- This topic has 1 reply, 2 voices, and was last updated 10 years, 1 month ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Affiliates Management Plugin for WordPress
by
WordPress Affiliate Manager › Forums › Affiliate Manager Plugin › Work with Hook API
Tagged: API, Hook, lead tracking, manual commission
Hi,
i inserted following code on a thank you page to track and pay for leads >>
$uniqid = uniqid();
$args = array();
$args[‘txn_id’] = $uniqid;
$args[‘amount’] = ‘0.01’;
$args[‘aff_id’] = $_COOKIE[‘wpam_id’];
do_action(‘wpam_process_affiliate_commission’, $args);
But now the commission applies 3 times?
Please advise, since this would be a really nice feature for your great plugin.
Hi, That means the code is getting executed three times. This could be resolved if you follow one of these options:
1) Fix the issue that’s causing your page to load multiple times
2) Use one simple ID for each submission instead of generating a unique ID before calling the hook. That way if one record is already in the database, multiple insertions with the same ID will fail.
Usually this type of issue doesn’t happen when the transaction ID comes from the payment gateway. Since you are not really processing any payments, I would recommend that you generate the unique ID beforehand and embed in the form as a hidden input field. When the form is submitted simple read the value of the hidden field (via $_REQUEST) and pass it to the action hook.