<?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>ClickBank Blog &#187; Clickbank Instant Notifications</title>
	<atom:link href="http://www.clickbank.com/blog/tag/clickbank-instant-notifications/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.clickbank.com/blog</link>
	<description>Affiliate Powered E-Commerce, Worldwide</description>
	<lastBuildDate>Thu, 19 Nov 2009 21:07:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using ClickBank Instant Notification</title>
		<link>http://www.clickbank.com/blog/2008/10/02/using-clickbank-instant-notification/</link>
		<comments>http://www.clickbank.com/blog/2008/10/02/using-clickbank-instant-notification/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 22:47:49 +0000</pubDate>
		<dc:creator>Beau Blackwell, ClickBank</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Clickbank Instant Notifications]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.clickbank.com/blog/?p=85</guid>
		<description><![CDATA[Posted by: Greg Lems, Director of Application Development
Please note: This post is intended for readers with some experience in programming and Internet servers.
I read once that in the very early days of Amazon.com, Jeff Bezos and his engineers had wired up their server to make a cash-register &#8220;ka-ching!&#8221; sound every time they made a sale.  [...]]]></description>
			<content:encoded><![CDATA[<p>Posted by: Greg Lems, Director of Application Development</p>
<p><em>Please note: This post is intended for readers with some experience in programming and Internet servers.</em><!--[if gte mso 9]><xml> Normal   0         false   false   false                             MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><xml> </xml><![endif]--><!--[if gte mso 10]></p>
<style>
&nbsp;/* Style Definitions */
&nbsp;table.MsoNormalTable
&nbsp;{mso-style-name:"Table Normal";
&nbsp;mso-tstyle-rowband-size:0;
&nbsp;mso-tstyle-colband-size:0;
&nbsp;mso-style-noshow:yes;
&nbsp;mso-style-parent:"";
&nbsp;mso-padding-alt:0in 5.4pt 0in 5.4pt;
&nbsp;mso-para-margin:0in;
&nbsp;mso-para-margin-bottom:.0001pt;
&nbsp;mso-pagination:widow-orphan;
&nbsp;font-size:10.0pt;
&nbsp;font-family:"Times New Roman";
&nbsp;mso-ansi-language:#0400;
&nbsp;mso-fareast-language:#0400;
&nbsp;mso-bidi-language:#0400;}
</style>
<p><![endif]--></p>
<p>I read once that in the very early days of Amazon.com, Jeff Bezos and his engineers had wired up their server to make a cash-register &#8220;ka-ching!&#8221; sound every time they made a sale.  As business picked up, they had to turn it off because it was going off all the time!  It got me thinking whether a fun little widget like this might be something that ClickBank publishers and affiliates are interested in.</p>
<p>To build something that performs an action with each sale, you can use ClickBank Instant Notifications, a feature we enabled earlier this year.  This post is about using this ClickBank feature.  It assumes that the reader has experience with programming and Internet servers.</p>
<p><span id="more-85"></span><strong>How ClickBank Instant Notification Works</strong></p>
<p>ClickBank Instant Notification works like this:</p>
<ol>
<li>A customer purchases a product for which you are the affiliate or publisher</li>
<li>ClickBank posts a notification to a URL you specify in your account</li>
<li>You respond with an HTTP 200 response code (&#8221;OK&#8221;) to acknowledge receipt of the information.</li>
</ol>
<p>This occurs not only for sales, but other actions that can occur on a transaction, such as refunds, chargebacks, cancellations of subscriptions, etc.</p>
<p>Assuming you have an Internet server that can listen to these requests, you can install code to respond to these requests and perform actions.</p>
<p><strong>Security is Important to ClickBank</strong></p>
<p>To ensure security of your ClickBank Instant Notifications, you can choose to have your requests sent by https.  Also, with every ClickBank Instant Notification we send along an encrypted string called &#8220;cverify&#8221; which only you (the account holder) can decrypt to ensure that someone isn&#8217;t sending you false ClickBank Instant Notifications.</p>
<p><strong>Enabling Instant Notification</strong></p>
<p>The first step to enabling Instant Notification is to log into your ClickBank account, go to your &#8220;My Site&#8221; page, and click &#8220;Edit&#8221; in the &#8220;Advanced Tools&#8221; box.  A link to request access to Instant Notification will appear. Click that link and follow the instructions. You will enter a URL where you&#8217;d like ClickBank to send your instant notifications.</p>
<p><strong>Writing Code to Process Instant Notifications</strong></p>
<p>Now that notifications are enabled, you need to create a script that can process the ClickBank notifications.  This particular snippet is in PHP; however, we also have a Java example in our documentation (see &#8220;Resources&#8221; below).</p>
<p>function cbProcess() {</p>
<p style="padding-left: 30px;">$key=&#8217;YOUR SECRET KEY&#8217;;<br />
$ccustname = $_REQUEST['ccustname'];<br />
$ccustemail = $_REQUEST['ccustemail'];<br />
$ccustcc = $_REQUEST['ccustcc'];<br />
$ccuststate = $_REQUEST['ccuststate'];<br />
$ctransreceipt = $_REQUEST['ctransreceipt'];<br />
$cproditem = $_REQUEST['cproditem'];<br />
$ctransaction = $_REQUEST['ctransaction'];<br />
$ctransaffiliate = $_REQUEST['ctransaffiliate'];<br />
$ctranspublisher = $_REQUEST['ctranspublisher'];<br />
$cprodtype = $_REQUEST['cprodtype'];<br />
$cprodtitle = $_REQUEST['cprodtitle'];<br />
$ctranspaymentmethod = $_REQUEST['ctranspaymentmethod'];<br />
$ctransamount = $_REQUEST['ctransamount'];<br />
$caffitid = $_REQUEST['caffitid'];<br />
$cvendthru = $_REQUEST['cvendthru'];<br />
$cbpop = $_REQUEST['cverify'];</p>
<p style="padding-left: 30px;">//first, calculate whether cverify is properly encrypted</p>
<p style="padding-left: 30px;">$xxpop = sha1(&#8221;$ccustname|$ccustemail|$ccustcc|$ccuststate|$ctransreceipt|&#8221;<br />
.&#8221;$cproditem|$ctransaction|$ctransaffiliate|$ctranspublisher|$cprodtype|&#8221;<br />
.&#8221;$cprodtitle|$ctranspaymentmethod|$ctransamount|&#8221;<br />
.&#8221;$caffitid|$cvendthru|$key&#8221;);</p>
<p style="padding-left: 30px;">$xxpop=strtoupper(substr($xxpop,0,8));</p>
<p style="padding-left: 30px;">if ($cbpop==$xxpop)<br />
{</p>
<p style="padding-left: 60px;">// cbverify was properly encrypted, proceed<br />
if ($ctransaction == &#8216;SALE&#8217;)<br />
{</p>
<p style="padding-left: 90px;">// Make a “CHA-CHING” Sound or perform some action.<br />
// Specific code will be dependent on operating system<br />
return 1;</p>
<p style="padding-left: 60px;">}</p>
<p style="padding-left: 30px;">}<br />
else<br />
{<br />
// cbverify was not properly encrypted, fail<br />
return 0;<br />
}</p>
<p>}</p>
<p><strong>Resources</strong></p>
<p>The best resource available to you to learn more about ClickBank Instant Notifications is the release notes for this feature which are here:</p>
<p><a href="https://www.clickbank.com/20080219_release_summary.html" target="_blank">https://www.clickbank.com/20080219_release_summary.html</a></p>
<p>Additionally, if you don&#8217;t want to write your own code, there are products available that do it for you already. Try searching on &#8220;ClickBank Instant Notification&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.clickbank.com/blog/2008/10/02/using-clickbank-instant-notification/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>
