ClickBank Blog ClickBank Blog Home ClickBank Blog Home Follow us on Twitter Become a ClickBank fan on Facebook ClickBank How To Videos on Youtube Subscribe via Email ClickBank flickr photo galleries

Using ClickBank Instant Notification

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 “ka-ching!” 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.

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.

How ClickBank Instant Notification Works

ClickBank Instant Notification works like this:

  1. A customer purchases a product for which you are the affiliate or publisher
  2. ClickBank posts a notification to a URL you specify in your account
  3. You respond with an HTTP 200 response code (“OK”) to acknowledge receipt of the information.

This occurs not only for sales, but other actions that can occur on a transaction, such as refunds, chargebacks, cancellations of subscriptions, etc.

Assuming you have an Internet server that can listen to these requests, you can install code to respond to these requests and perform actions.

Security is Important to ClickBank

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 “cverify” which only you (the account holder) can decrypt to ensure that someone isn’t sending you false ClickBank Instant Notifications.

Enabling Instant Notification

The first step to enabling Instant Notification is to log into your ClickBank account, go to your “My Site” page, and click “Edit” in the “Advanced Tools” 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’d like ClickBank to send your instant notifications.

Writing Code to Process Instant Notifications

Now that notifications are enabled, you need to create a script that can process the ClickBank notifications.  For code examples in many popular languages, visit the Instant Notification Service article below.

Resources

The best resource available to you to learn more about ClickBank Instant Notifications is the Help Center article for this feature which is here:

Instant Notification Service

Additionally, if you don’t want to write your own code, there are products available that do it for you already. Try searching on “ClickBank Instant Notification”.

About

Beau is the Client Knowledge Guru for ClickBank and covers the latest trends, tips and techniques for building profitable Internet marketing businesses.

Take a look at these related posts:

  1. The Power of Data
  2. Protecting Your Hoplinks
  3. Operate in Real Time with the ClickBank API
  4. Important Changes to Product Test Process for Vendors
  5. More Pitches, More Profits – Introducing the New PitchPlus™ Feature!

43 Responses to “Using ClickBank Instant Notification”

  • Ron Davies says:

    Great stuff, but not working for us.

    Wer receive the email, but there is no data – just headings.

    This is the body of the email. Note that the data is missing. I have 26 transactions like this.

    Product:
    Publisher:
    Affiliate:
    Transaction:
    Amount:

  • Greg Lems, ClickBank says:

    Ron,

    You mentioned receiving an email but there’s nothing in the code that was posted about sending an email, so I’m curious what you’re trying to do. The IPN only sends an http request to a server you host. Are you taking your IPN and then trying to convert it into an email? If so, you may not be extracting or reassembling the variables correctly. The IPN reference document mentioned above lists all the variables sent, make sure you’re extracting them and passing them along properly.

  • Lucie Bellemare says:

    But is it possible to simply receive an email from ClickBank whenever we get a sale (as an affiliate or as a publisher)?

  • Beau Blackwell, ClickBank says:

    Hi Lucie,

    ClickBank publishers automatically receive email notifications whenever one of their products sells. For affiliates, the only way to receive emails when sales are made is to use the Instant Notification system.

  • Kevin says:

    Hi,

    I’ve checked with support. They said that instant notification is disabled for affiliates. So is it or is it not working for affiliate?

  • Greg Lems, ClickBank says:

    Hi Kevin,

    I think there’s some confusion. What support must have meant is that affiliates don’t automatically get emailed after each sale like publishers do- that aspect of instant notification is disabled for affiliates. I can assure you that if you want to use Instant Notification in the method described in my post, it is definitely enabled for affiliates.

  • Shah nawaz says:

    Today Internet Marketing is big bussiness in the world. In India big future for Internet marketing.

  • Mohamed Asik M says:

    Hi Greg,

    In recurring payment for instant notification, how to check the relationship between first payment and second payment?

    for example:

    Person A, purchased a product ‘B’ in January 2009
    Second payment that i received from January 2010 (if i used annual subscription)

    In the above case, How to maintain the relationship between the first payment (January 2009) & second payment (January 2010)?

    Thanks in advance

  • Greg Lems, ClickBank says:

    Mohamed,

    You use the receipt numbers to associate transactions for the same subscription. All transactions for the same transaction start with the same first 8 characters, then subsequent transactions have the characters “-B002″ appended on the end for the first rebilling, then “-B003″ for the second rebilling, etc.

    For example, if the receipt for the first purchase of the subscription is “12345FJK”, the receipt for the second purchase will be “12345FJK-B002″, the third will be “12345FJK-B003″. Hope this helps.

    Greg

  • Mohamed Asik M says:

    Great Response & am clear

    Thank You
    Greg

  • Mohamed Asik M says:

    Another one question for INS

    i need the detail about “cvendthru” variable.

    is it vendor variable..

    i passing the below query strings into order form name=Asik&user_id=14&user_type=f

    How to get my custom variable “user_id” & “user_type” in my INS page?

    or any other way to get my custom variable through INS page?

    INS=Instant notification service

    Thanks in advance

  • Greg Lems, ClickBank says:

    Mohamed,

    Yes, those variables you’re passing will be passed through to you as the cvendthru variable.

    The Release Summary for Instant Notification should have all the details you need for understanding the cvendthru variable, please take a look:

    https://www.clickbank.com/20080219_release_summary.html

    Thanks,
    Greg

  • Mohamed Asik M says:

    Thanks a lot “Greg” for your response

    yes i already read out that release summary but i can not get more details about “cvendthru”

    Please confirm me in the below cases, which one is right to get my custom variables?

    Case 1:
    Query String
    name=Asik&user_id=14&user_type=f
    INS Page
    $user_id=$_REQUEST["user_id"];
    $user_type=$_REQUEST["user_type"];

    Case 2:
    Query String
    name=Asik&cvendthru=14_f
    INS Page
    $cvendthru=explode(“_”,$cvendthru);
    $user_id=$cvendthru[0];
    $user_type=$cvendthru[1];

  • Greg Lems, ClickBank says:

    Mohamed,

    Unfortunately neither of those code examples you posted will accomplish what you’d like to do. Here is some code that should achieve what you’re looking for:

    // get cvendthru request parameter
    $cvendthru = $_REQUEST["cvendthru"];

    // create empty array to store name value pairs from cvendthru
    $data = array();

    // break up cvendthru by ‘&’ delimiter
    $urldata = explode(“&”, $cvendthru);

    // loop thru array created by above command
    for($i = 0; $i 0) {
    $data[$key] = $value;
    }
    }

    // loop thru associative to show name/value pairs
    foreach ($data as $key => $value) {
    echo $key.” -> “.$value.”\n”;
    }

    // syntax to get data by key from associative array
    echo “Get individual item from cvendthru data: “.$data["detail"].”\n”;

    Hope that helps,
    Greg

  • Mohamed Asik M says:

    Hi Greg,

    Thank you, Finally i got the point but your above code is little bit complicated to understand..some syntax error there.. please rectify that

    Simple Code :

    $cvendthru = $_REQUEST["cvendthru"];
    // for eg: $cvendthru=”user_id=14&user_type=F”;

    parse_str($cvendthru, $cdata);
    echo $cdata["user_id"];
    echo $cdata["user_type"];

    Once again thanks for your responses

    Cheers :)

  • bahar says:

    Hello,

    I am setting up the instant notification service for one of my client. I am not sure how to test if I am getting response. I have set one of the products as “test” product and tried with the test product.

    But I am not getting any response. In home page, I checked the “test url” option and it returns a HTTP 200 response.

    is INS working with test products?

    have a nice day.

  • [...] service. Greg Lems, ClickBank’s director of application development, recently wrote a blog post outlining how to use the Instant Notification [...]

  • Oleg says:

    I’m fairly confident I set everything up right.

    When I press “test” next to the INS link, everything works fine.
    When I try to make a test transaction, I don’t get an email. It’s not due to a security key issue as I have it set to email me whether it passes or fails. Basically, if the page it called, it should email me – but nothing happens with a test transaction.

    As bahar asked above, does INS work with test products?

  • Greg Lems, ClickBank says:

    Bahar and Oleg,

    Test purchases do not cause Instant Notification messages to go out. You must use the Instant Notification “test” button to test receiving Instant Notification messages. We are considering enhancing test purchases to send Instant Notifications in the future however a release date for this enhancement has not been set.

  • Erik says:

    Ha! Thankfully I read Greg’s post of June 1. I’ve been beating my head against a wall trying to figure out why my test purchases were not generating an IPN ping by ClickBank. Generally speaking, you guys are amazing and have a killer e-commerce platform for us vendors to use. One thing that’s especially nice is the ability to do test purchases. To the extent the test purchase process can be enhanced to generate an IPN, that would be fantastic! Anyway, keep up the great work.

  • Venu says:

    Hi All,

    My INS url is http://www.xxxxx.com/ClickBankINS.php?user_id=14&user_name=test.
    When i click on test button beside url textbox, system posting test data to this url. Fine, when i see request object i getting all values, but i am getting $_REQUEST['cvendthru'] as null. What i expect is querystring i passed in url.But it is not coming in $_REQUEST['cvendthru']; And i am getting $_REQUEST['user_id'], but not $_REQUEST['uesr_name']

    Am i doing anything wrong or am i missed anything..

    Thanks in advance
    -Venu

  • Marco says:

    I’m having the same problem as Ron above…
    I only get this:
    Product:
    Publisher:
    Affiliate:
    Transaction:
    Amount:

    I’m using the code found on this forum
    http://forums.digitalpoint.com/showthread.php?p=8675162

  • eric says:

    Thank God! i read the June 1 admin post….

    Just a question… Is it anywhere near “now” that this Test Product Instant Notification will be implemented?

    Cheers!

  • http://ITEM.VENDOR.pay.clickbank.net?x=1&y=2&z=3

    Would result in an IPN post with cvendthru having a value of “x=1&y=2&z=3″. Is this correct?

  • Beau Blackwell, ClickBank says:

    Hi Adam,

    Sorry about that, that’s an old link. All of the info you need regarding Instant Notification can now be found here:

    http://www.clickbank.com/help/account-help/account-tools/instant-notification-service/

    Thanks for the catch!

  • Gyuri says:

    I am transitioning to be a Clickbank vendor, and have built an IPN solution for Drupal that you might find useful as well. This is my way of giving back to the community and Clickbank.

    If you wouldn’t yet know Drupal is the premium open source and free CMS of choice, used by sites like the White House, Sony etc. Approximately 1% of websites out there.

    Check it out, and wish you lots of success!
    http://drupal.org/project/clickbank_ipn

  • Beau Blackwell, ClickBank says:

    Thanks Gyuri! I just ran across your module and tweeted about it this morning. Drupal’s a pretty challenging but powerful platform, so I’m sure this will be useful for many people.

  • Dan Kelly says:

    I’m not getting IPN notifications for affiliate sales.

    Do I have to turn that on in my account somewhere? (Besides just entering the IPN URL)

    And, if I am also a merchant who uses IPN, how do I differentiate a sale where I am an affiliate and a sale where I am the merchant?

    Thanks so much!

  • Dan Kelly says:

    Also, I receive IPN for transactions that I’m the merchant.

    But, it seems that many of the variables are missing.

    Is there supposed to be a value for $_REQUEST['ctransaffiliate']?

    I made sure I was the affiliate for a test transaction, but I didn’t get any value for $_REQUEST['ctransaffiliate'] in the IPN.

  • Dan Kelly says:

    Also, what is ‘ctransamount’? Is it the ammount that is credited to my account * 100?

    Example

    ctransamount = 4436

    Does that mean I would see a credit of $44.36 if it were a real transaction?

  • Beau Blackwell, ClickBank says:

    Dan,

    In answer to your questions:

    You will receive a notification when you are the vendor or affiliate. It will use the URLs on your site for all notifications.

    ctransaffiliate is the nickname of the affiliate on the transaction. All fields will be present, even if they have no value. So in the case of an empty ctransaffiliate field, it was a transaction without an affiliate. Test sales do not include affiliates; the affiliate is removed from the transaction and there is information about this on the success page on test transactions.

    Just as a heads up, the caffitid field will only have data when you are the affiliate on the transaction and cvendthru field will only have data when you are the vendor, although both fields are present at all times.

    ctransamount is the amount made on the account receiving the IPN for that transaction. This does not equal what the customer payed for the product. You can use the API to pull the customer amount on the transaction.

    Hope those answers help!

  • Joshua says:

    The Documentation Suggests The Following PHP:

    $ccustname = $_REQUEST['ccustname'];

    However, I don’t get any such field posted to my URL. Instead I get ccustfirstname and ccustlastname, and even ccustfullname. There are also several other inaccuracies and discrepancies in the documentation of the field names. Because of the intense number of possible permutations, I can’t seem to figure out what combination of fields, in what order, will generate the correct sha1 hash!

    How am I supposed to verify that the submission is really from ClickBank, unless I have accurate instructions on how to reproduce the hash code?

    Even after correcting two or three post variable names the example code does not produce the correct hash. In other words:

    $_REQUEST['cverify'] != sha1(”$ccustname|$ccustemail|$ccustcc|$ccuststate|$ctransreceipt|”
    .”$cproditem|$ctransaction|$ctransaffiliate|$ctranspublisher|$cprodtype|”
    .”$cprodtitle|$ctranspaymentmethod|$ctransamount|”
    .”$caffitid|$cvendthru|$key”);

    Any hints or suggestions?

    Thanks In Advance.

  • Beau Blackwell, ClickBank says:

    Hi Joshua,

    I’ve updated the Instant Notification Help Center article to reflect the fields available in versions 1 and 2 of Instant Notification. Please check that out and see if it helps solve your problem. If not, let me know and I’ll try to get you more detailed support.

  • Paul says:

    Hi Beau

    I too can’t produce the correct hash to save my life, and I’m a pretty experienced PHP developer :)

    However, that doesn’t really bother me right now. I want to check that caffitid is the correct POST variable name, because I’m always seeing it empty and yet I’m sending through a tid with my hoplinks. Can you confirm that I’ve got the correct name and that the tid value should be coming through as caffitid?

    Cheers.

  • Beau Blackwell, ClickBank says:

    Paul,

    Could you confirm which version of Instant Notification you’re using? v1 or v2?

  • Joshua says:

    Beau, your Sept 22 post was literally the first mention I heard anywhere of there even being a v2. It turns out that’s what the problem was. The only available documentation was for v1 (without even saying that there WAS a v2), but your default setting was to use v2. I didn’t notice that there was a choice between v1 and v2 until I went back and looked. This, it seems, was my problem. I changed back to v1, and it all works now. Thanks.

    I sure wish I had known about the v2 documentation before having developed all this for v1 already.

  • Paul says:

    I’m using 2.0, and realised that you had provided a full breakdown of v2.0 variables on the page you reference above.

    So now I’m sending my tid via the hoplink in the following format: http://example.hop.clickbank.net/?tid=aw12345

    But when I check the POST variable ctid in the IPN it is still empty?

  • Adrian Ling says:

    Hi Beau,

    The introduction of IPN version 2 caught me by surprised. Most of the existing scripts out there are using version 1 by default, but the default setting is IPN v2 when CB clients add the IPN URL for the first time.

    This will cause many of the existing scripts that uses the IPN to break. The default should be set to ’1′

    I already received a number of ‘complaints’ from customers who said my software doesn’t work … but when changed/set to v1, it is OK.

    Best regards,
    Adrian

  • Hi Beau,

    I am also facing the problem with V2. I am using the Java code given in the help center article, the hash codes are not matching. Created a support ticket just now(2420248), any help would be appreciated.

    Cheers,
    Sunil.

  • Steve says:

    I must say I am completely confused! And I’m experienced in php web development!
    I am using the code found in the documentation for the instant notifications the .php script.

    However I have tried to use all three versions 1.0, 2.0 and 2.1 and none of them produce the matching sha1 codes.

    Has anyone got a working configuration that they would share? like the version they have set in their “My Site” and then a verification script??? in php?

  • Beau Blackwell, ClickBank says:

    Steve,

    I checked with one of our developers, and he suggested making sure the “Secret Key” you’ve configured within your ClickBank account matches what you’re using in your script.

  • Battra says:

    Anyone has luck with this? No matter what I can’t get the hash produce the correct value. Yes, secret key matches (I even copy-paste from my ClickBank account) and I also copy the sample script given.

Leave a Reply

Please do not enter a keyword phrase, product, or service name as your name in the comment section, or your comment may be deleted as spam. If you need customer service help with a ClickBank order, please click here.

Recent Comments
  • Miles Baker: Congratulations Jonathan!
  • Jovenmarlo: Thanks. This is my first time to read an article from you and I like your advice.
  • Danvelyn: Just a beginner, a Newbie. How do you use these features? I’m floundering and lost. I need...
  • Warray: Hi..I like this TID. Knowing how to set it will make me easier how to track and determine which marketing...
  • Izola Berendt: The hard part about SEO and developing ranking is quality, and then keeping that quality, so that...