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’];
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.
You must be logged in to reply to this topic.