Copyright
© 2003, Groundbreak.com. All rights reserved.
Any comments, suggestions, or mistakes: smiles@groundbreak.com
|
Integrating
Ultimate Affiliate with 2checkout.com
2checkout.com
works very similar to paysystems.com, and the setup is about the
same.
However, the
one difference between the two systems is that paysystems will trigger
sale.cgi remotely on both initial AND recurring sales, while 2checkout.com
will only do this on the intitial sale. So, if you are selling subscriptions
through 2checkout.com you would have to have the affiliate script
duplicate the commissions monthly via recur.cgi running by cron...yes,
it's a little more complicated and requires a little more administration
if you want to give recurring commissions through 2checkout.
PART ONE:
Setting up your 2checkout.com order buttons
Here's
is the code for an example button:
<form method=post
action=https://www.2checkout.com/cgi-bin/sbuyers/purchase.2c
>
<INPUT type="submit" value="Click to pay
thru 2CheckOut">
<input type=hidden name=sid value=25421>
<input type=hidden name=product_id value=1>
<input type=hidden name=quantity value=1>
<input type=hidden name=merchant_order_id value=AFFILIATEUSERNAME>
</form>
Or, for recurring
subscriptions:
<form method=post
action=https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c
>
<!--Remove the demo parameter for live processing, set
to Y to test.-->
<input type=hidden name=demo value="Y">
<input type=hidden name=sid value=25421>
<input type=hidden name=product_id value=X>
<input type=hidden name=merchant_order_id
value=AFFILIATEUSERNAME>
<INPUT type="submit" value="Click to pay
thru 2CheckOut">
</form>
Note: the button above isn't active - just an example... |
Notice that
in each order link/button you can include an extra field called
merchant_order_id where you will include the referring affiliate's
username.
To dynamically
insert the referring affiliate's username into these buttons, you
need to put some javascript code on the page to capture the affiliate
cookie and insert it into the buttons. On the page with your order
buttons you will put this javascript code in the top of the page
between the <head></head> tags:
<script>
function getCookie (name) {
var dc = document.cookie;
var cname = name + "=";
var clen = dc.length;
var cbegin = 0;
while (cbegin < clen) {
var vbegin = cbegin + cname.length;
if (dc.substring(cbegin, vbegin) == cname) {
var vend = dc.indexOf (";", vbegin);
if (vend == -1) vend = clen;
return unescape(dc.substring(vbegin, vend));
}
cbegin = dc.indexOf(" ", cbegin) + 1;
if (cbegin== 0) break;
}
return "";
}
affiliatecookie = getCookie('COOKIENAME');
</script>
Make sure to
replace COOKIENAME with the name of the affiliate cookie you set
at the main admin.cgi configuration page.
Then, in each
order link/button you will place the bold javascript tag below:
<form method=post
action=https://www.2checkout.com/cgi-bin/sbuyers/purchase.2c >
<INPUT type="submit" value="Click to pay thru
2CheckOut">
<input type=hidden name=sid value=25421>
<input type=hidden name=product_id value=1>
<input type=hidden name=quantity value=1>
<script>
<!--
document.write("<input type=hidden name=merchant_order_id
value="+affiliatecookie+">");
-->
</script>
</form>
PART TWO:
Modifying your 2checkout.com account
In
the 2checkout.com control panel, you can go to Account Details
> Return to find all of their "passback" settings.
1. On that page
you will find separate passback settings for Products, Recurring
Charges, and Shopping Cart sales. Turn on the appropriate ones and
set the passback url to:
http://www.yoursite.com/cgi-bin/affiliates/2checkout.cgi
The 2checkout.cgi file is in the /extras/PROCESSORINTEGRATION folder
of the UA zip file. You will upload this file to the same directory
as the other cgi scripts and chmod it 755. Also, you will need to
open it up and make sure the "yoursite" in the url is
set to the correct url for the 2checkout.cgi file on your own site.
Note that when
you edit this url, most of the default settings are correct. However,
if you've set the "secret" word at the UA admin page,
you'll have to add a secret word variable on to the url in 2checkout.cgi:
http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?cashflow=$total&affiliate=$merchant_order_id&goods=$order_number&secret=SECRET
PART THREE:
Changing settings in the affiliate script
At the admin
page configuration, you should:
1. Have the
IP tracking after a sale turned off
2. The referral tracking after a sale turned off
3. Secret word can be set to something or left blank
4. Sale.cgi should be set to execute as a script
|