<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tortoise IT &#187; Paypal</title>
	<atom:link href="http://www.sean-barton.co.uk/tag/paypal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sean-barton.co.uk</link>
	<description>by Sean Barton, a freelance PHP website developer in Crewe, Cheshire</description>
	<lastBuildDate>Tue, 31 Jan 2012 17:34:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Clickbank Payment Processor Integration</title>
		<link>http://www.sean-barton.co.uk/2009/01/clickbank-payment-processor-integration/</link>
		<comments>http://www.sean-barton.co.uk/2009/01/clickbank-payment-processor-integration/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 13:40:07 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Clickbank]]></category>
		<category><![CDATA[Payment Processors]]></category>
		<category><![CDATA[click bank]]></category>
		<category><![CDATA[Clickbank Account]]></category>
		<category><![CDATA[Instant Payment Notification]]></category>
		<category><![CDATA[Ipn]]></category>
		<category><![CDATA[Payment Processor]]></category>
		<category><![CDATA[Paypal]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/2009/01/clickbank-payment-processor-integration/</guid>
		<description><![CDATA[Clickbank is an payment processor that doesnt seem to have any documentation or working complex examples. However, and this is a big however, they take payments on their site from a single url (ie no form need be posted to their site) and even better it handles the entire affiliate click through arrangements for your products. They seem to have a monopoly on this particular area so have no need to upgrade their systems to fall more inline with other processors (like Paypal for example). I shall start from the beginning with the initial steps. Let us assume that we &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2009/01/clickbank-payment-processor-integration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Clickbank is an payment processor that doesnt seem to have any documentation or working complex examples. <strong>However</strong>, <em>and this is a big however</em>, they take payments on their site from a single url (ie no form need be posted to their site) and even better it handles the entire affiliate click through arrangements for your products. They seem to have a monopoly on this particular area so have no need to upgrade their systems to fall more inline with other processors (like Paypal for example).</p>
<p>I shall start from the beginning with the initial steps. Let us assume that we have a clickbank account for the time being&#8230;</p>
<p>The first step is to log into your clickbank admin account and set up your products with the price, name and, something else they require, a thankyou page.</p>
<p>Note that for the first product you sell with clickbank there is a $50 fee for the priviledge of having it activated. I have no idea whether you get this back or not.</p>
<p>So set up your product, get it activated and keep note of the Product ID&#8230;</p>
<p>As previously mentionned, Clickbank takes money for you when you send your clients to a specific payment page on a url which is formed in the following way:</p>
<p><em>http://[product_id].[clickbank_user_name].pay.clickbank.net</em></p>
<p>Where the parts in square brackets must be replaced with the appropriate information.</p>
<p>That is essentially it&#8230;. you create the product, generate the url, put it on your site and start collecting money.</p>
<p><strong>But </strong>what if you want to do something useful with the payment like provide a service of some sort or systematically keep a record of transactions on your own server?</p>
<p>For this you need to enable the IPN (Instant Payment Notification) service which requires ticking a couple of boxes to prove you aren&#8217;t an idiot (which, if doing this type of integration, you most likely won&#8217;t be). You also need to give it the url to &#8216;Call Back&#8217; to (The url of the script that will be dealing with the data collected during the transaction).</p>
<p>Once IPN has been enabled you can write a script to receive the data sent by Clickbank on each payment. This basically needs to do three things:</p>
<ul>
<li>Verify that the request is valid</li>
<li>Send back a 200 OK response code</li>
<li>Do anything you like with the data</li>
</ul>
<p>The first part is fully documented on their site, carefully hidden but fully documented with examples in various languages. It basically consists of taking the first 8 characters from a sha1 encoded string built up of the concatenated variables sent via POST with your &#8216;Secret Key&#8217; on the end. When compared to the verify code they send you in the same POST request you can see whether the request is genuine or not.</p>
<p><em>See the &#8216;You might also be interested in&#8217; section at the bottom of this post for a code example and links to official documentation</em></p>
<p>This is the first time that I have mentioned the secret key but it is just that, a key which you set up in the Clickbank admin system that you also put in your script but NOT tell anyone else.</p>
<p>Once you have verified the request is a genuine one then you can move onto the part that does something to your site/database.</p>
<p>The data that it sends you says:</p>
<ul>
<li>Type of transaction it is (SALE, BILL, REFUND, TEST&#8230;)</li>
<li>Product sold</li>
<li>Time and date of sale (in a useful unix timestamp)</li>
<li>Who purchased it (name and email)</li>
<li>Product ID</li>
</ul>
<p>This is useful for basic systems that simply log a sale so with this data you should be able to email yourself to send a book or get it to activate an account etc..</p>
<p>I needed a bit more information than this though so needed to use another variable it sends through called &#8216;cvendthru&#8217;. What cvendthru does is gives you a list of the extra arguments which were given against the sell url (example above but with &#8216;/?myvariable=test&#8217; or something useful at the end).</p>
<p>This makes life alot easier when updating records and storing more information because it can contain anything at all in a string which looks like &#8216;var1=1&amp;var2=2&amp;var3=3&amp;var4=&#8230;&#8217;. You can use your script to &#8216;explode&#8217; this into an array and use the variables contained within. It did take me a few attempts to work out how to do this as Google seems to have few results with cvendthru in the name.</p>
<p>You might also be interested in:</p>
<ul>
<li><a href="http://www.clickbank.com/blog/2008/10/02/using-clickbank-instant-notification/">Using Clickbank Instant Payment Notification (Official Clickbank Blog)</a></li>
<li><a href="https://www.clickbank.com/20080219_release_summary.html">IPN Release Summary (Code examples and a quick walkthrough)</a></li>
</ul>
<p><em>If you have done any clickbank integration and feel I have missed anything or given the wrong information then please contact me by leaving a comment on this post, the forum or sending an email to barton.sean@gmail.com</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2009/01/clickbank-payment-processor-integration/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 7/21 queries in 0.075 seconds using disk
Object Caching 327/345 objects using disk

Served from: www.sean-barton.co.uk @ 2012-02-08 22:06:49 -->
