How can I use a third-party affiliate script with 2CO?

2Checkout.com supports almost any affiliate program that works off of a hidden image tag on the sales confirmation page.

Just fill in the string that is provided by your affiliate program in the Seller Admin under Look and Feel. 2Checkout.com payment routines will fill in dynamic parameters like “order number”, “order total”, “your product id”, “quantity ordered”.

The Affiliate link will only work if you have Direct Return OFF. The hidden image tag is placed on the 2Checkout confirmation page after the sale and with Direct Return ON, this page is by passed.

To have the string populated dynamically, put the following variables in the appropriate location. The payment routine will fill them in after the sale is complete:

$a_order - 2Checkout.com Order Id.
$a_total - Total Dollars Paid.
$a_product - Your product id
$a_quantity - Quantity of product id sold.

Example src string:

https://affiliate.com/sale.cgi?order=$a_order&total=$a_total&product=$a_product&quantity=$a_quantity

If the buyer bought 1 of your product id 01-Widget for $2.00, after the sale the string would become

http://affiliate.com/sale.cgi?order=123456&total=2.00&product=01-Widget&quantity=1

How do I use the MD5 Hash?

The MD5 hash is provided to help you verify the authenticity of a sale. This is especially useful for vendors that sell downloadable products, or e-goods, as it can be used to verify whether sale actually came from 2Checkout and was a legitimate live sale. We intentionally break the hash code for demo orders so that you can compare the hash we provide with what it should be to determine whether or not to provide the customer with your goods or not.

To calculate the MD5 hash, you need to make a string that contains the information described below and pass it in as the value to your scripting languages MD5 function. Below is an example:

md5 ( secret word + vendor number + order number + total )

The secret word is set by yourself on the Site Managment page. The vendor number is your numerical vendor/seller ID number. The order number is the order number for the sale. The total is the numerical value for the total amount of the sale.

Demonstration:

Secret Word => tango
Vendor Number => 123456
Order Number => 9999999
Total => 5.99

md5hash = md5( tango12345699999995.99 )

It is important to note that the MD5 hash must also be converted to upper case letters for a clean comparison. How this is done depends on the scripting language that you use. Below are some examples of how to compute the MD5 hash using PHP. This should illustrate how this process works.

The following code would be applicable to orders placed using our Plug and Play cart and our proprietary third party set of parameters.

$string_to_hash = “tango123456″ . $_POST[”order_number”]
.
$_POST[”total”];
$check_key = strtoupper(md5($string_to_hash));

echo (”Returned MD5 Hash : ” . $_POST[”key”]
. “<BR>”);
echo (”Should be : ” . $check_key . “<BR>”);

if($check_key == $_POST[”key”]){
// At this point the expected key and the returned key match, so the customer should be given access to the download
// This is where you would want to put the code or page for the download
echo (”<center>They match!</center>”); }
else {
// At this point the keys do not match, so either the attempt was fraudulentor a demo order
// This is where you would put the code or page for an unsuccessful attempt
echo (”<center>They do NOT match! Was this a demo order?</center>”);}

The following code would then be applicable to orders placed using the Authorize.net
parameter set.

$string_to_hash = “tango123456″ . $_POST[”x_trans_id”]
.
$_POST[”x_amount”];
$check_key = strtoupper(md5($string_to_hash));

echo (”Returned MD5 Hash : ” . $_POST[”x_MD5_Hash”]
. “<BR>”);
echo (”Should be : ” . $check_key . “<BR>”);

if($check_key == $_POST[”x_MD5_Hash”]){
// At this point the expected key and the returned key match, so the customer
should be given access to the download
// This is where you would want to put the code or page for the download
echo (”<center>They match!</center>”); }
else {
// At this point the keys do not match, so either the attempt was fraudulent
or a demo order
// This is where you would put the code or page for an unsuccessful attempt echo (”<center>They do NOT match! Was this a demo order?</center>”);}

The MD5 hash is also provided to help you verify the authenticity of INS posts. The MD5 hash that is sent with INS posts is a hash of sale_id + vendor_id + invoice_id + secret word in the md5_hash parameter.


Demonstration:

sale_id => 9999999999
vendor_id => 123456
invoice_id => 1111111111
Secret Word => tango
md5hash = md5( 99999999991234561111111111tango )

The following code would be applicable to orders placed using our Plug and Play cart and our proprietary third party set of parameters.

$string_to_hash = $_POST[“sale_id”] . “123456” . $_POST[“invoice_id”] . “tango”;
$check_key = strtoupper(md5($string_to_hash));
echo (“Returned MD5 Hash : ” . $_POST[“md5_hash”]
. “
”);
echo (“Should be : ” . $check_key . “
”);
if($check_key == strtoupper($_POST[“md5_hash”])){
// If the expected key and the returned key match the authenticity of the message has been validated.
echo (”They match!”); }
else {
// At this point the keys do not match.
// This is where you would put the code for an unsuccessful attempt.
echo (“They do NOT match!”);}

Please note that help with implementing the MD5 hash into your return script is beyond the realm of 2Checkout.coms support. This document is provided merely as a reference document to help point you in the right direction. How the MD5 hash is computed is Dependant upon the scripting language that you use. Implementation of any MD5 hash checking is solely on your end or your server. 2Checkout.com can not provide you with support in implementing this or troubleshooting your implementation. We provide you with the hashes as a convenience to help you protect your digital goods.

The following links may be of interest to you if you are looking for more information on the MD5 algorithm and its use.

http://userpages.umbc.edu/~mabzug1/cs/md5/md5.html
http://en.wikipedia.org/wiki/MD5
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemSecurityPolicyHashClassMD5Topic.asp

We have also intentionally designed the MD5 hash not to work for demo sales as was explained earlier. If the sale is in demo mode, the order number used to create the hash will be forced to a one, which will cause the hashes to be different when you compare them. If you wish to test the hashes, you’ll have to place a live test order using a real credit card number.

What PHP code can I use to test return parameters?

Below is a sample PHP script that will catch all Post and Get parameters upon return and print the names of the parameters with their value back to the screen. This may help you develop your return process. Please note that we do not support third party scripts, so we also can not troubleshoot the script itself. It is being provided for your convenience only. We can help you if you are having problems receiving any passback parameters though.

<?php //display all post and get parameters

	echo "<h1>Get Parameter/s:</h1>";
	echo "<pre>";
	if($_GET)
		print_r($_GET);
	else
		echo "There are no get parameters.";
	echo "</pre>";
	echo "<hr/>";
	echo "<h1>Post Parameter/s:</h1>";
	echo "<pre>";
	if($_POST)
		print_r($_POST);
	else
		echo "There are no post parameters.";
	echo "</pre>";

?>

I need assistance with membership script support, who do I contact?

For support on the Free Membership Script, you need to contact the maker MembershipClientPro.com, who provides the script free for Vendors to use. You can contact them at Lite@MembershipClientPro.com

Recent Posts from the Community:

Invalid Amount

posted by: nherzul

will this do

posted by: daragrams

INS parameters

posted by: gvalex

Paypal option

posted by: asgsupp
More from the community »

Now a faster, easier way to get paid – the 2CO reloadable MasterCard®.

Sign up today and receive a $10 credit on your card.


Click here to learn more.

Spotlight Supplier

Spotlight Supplier

Vacation Rental Software

Spotlight Product

Spotlight Product

Visualizer Photo FX


Popular Tags