Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Duplicate sales logged on download page refresh

by

Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › Duplicate sales logged on download page refresh

Tagged: affiliate, Duplicate Sales

  • This topic has 2 replies, 2 voices, and was last updated 13 years, 5 months ago by coryshaw.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • November 17, 2011 at 9:46 pm #4802
    coryshaw
    Member

    I’ve recently bought, installed, and configured the affiliate plugin. Everything seems to work great except for one thing…

    When a user makes a purchase via paypal (I’ve configured PayPal option 1: PDT), PayPal redirects the user to a page outside of wordpress, so I used the API get option to give the affiliate credit for the sale.

    Paypal adds the following string to the url on the download page after the redirect:

    tx=57862310054145335&st=Completed&amt=49.00&cc=USD&cm=&item_number=

    The issue I’m having is that when I refresh the download page, the affiliate plugin logs each refresh as a sale. The affiliate gets an email every refresh and I’ve refreshed the affiliate stats page to verify this.

    I’m using the following php code on my page:

    $affiliate_id = $_COOKIE;

    if ($affiliate_id){

    $secret = “my secret id”;

    $referrer = $affiliate_id;

    $sale_amt = $_GET;

    $transaction_id = $_GET;

    $prepared_data = “?secret=”.$secret.”&ap_id=”.$referrer.”&sale_amt=”.$sale_amt.”&transaction_id=”.$transaction_id;

    $get_url = “http://myurl.com/wp-content/plugins/wp-affiliate-platform/api/post.php”.$prepared_data;

    // Execute this GET Request

    file_get_contents($get_url);

    }

    I was hoping that the “tx” attribute that paypal returns would log as a transaction_id, and upon refresh it wouldn’t log extra purchases.

    Any ideas?

    Thanks!

    November 18, 2011 at 12:16 am #38641
    admin
    Keymaster

    You have a mistake in the code… the transaction_id parameter name needs to be changed to txn_id. So it should be like the following:

    $prepared_data = "?secret=".$secret."&ap_id=".$referrer."&sale_amt=".$sale_amt."&txn_id=".$transaction_id;

    You are also not checking for the unique transaction ID in the database before calling the commission awarding API. The affiliate plugin has a built in integration option that can work with PayPal PDT and will take care of the issue… any reason why you are not using that build in option?

    Anyway, I have also made a slight change in the API so it does the check for you before adding the commission (this will prevent duplicates). Please get a new build of the plugin from here and update it:

    https://support.tipsandtricks-hq.com/update-request

    November 18, 2011 at 6:35 am #38642
    coryshaw
    Member

    That did the trick. thanks so much for your help, and for the awesome plugin you’ve created! Cheers.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ