Any Clickbank programmers out there? Have a question!

19 replies
Hi

I'm building an application that makes use of ClickBank's payment notification service. The code to work with this seems straightforward, however I have run into a mystery that I was hoping someone could shed some light upon.

I'm capturing the payment notification message and storing the results in a database, and that seems to work. I captured the test data that you can generate from the ClickBank site, and also have been capturing test purchases made before submitting a product for approval.

All seems to work, but when I try to simulate a test purchase made with an affiliate I don't seem to get the affiliate name in the response, even though there is a field for it. I also don't get the affiliate name in the e-mail ClickBank sends after the purchase, so I'm wondering if this is just because I am in test mode?

I know ClickBank is aware of the affiliate, as I see the affiliate ID on the payment page and the amount that I earn is half what it is without the affiliate ID attached (and the affiliate gets 50% so that is correct). But I don't get the affiliate ID in my payment notification response.

If anyone knows why this is happening please let me know. Do I need to use one of the ClickBank API's after the transaction to get the affiliate ID? Or is what I'm seeing only because I am still in test mode? Is there any way to simulate an actual transaction (like a "sandbox environment")?

Also, I looked for a ClickBank developers forum and couldn't find one, at least not on ClickBanks site. Does anyone know a forum or good resource for ClickBank developers? The amount of information I've been able to find is minimal - quite a contrast from working with the PayPal IPN.

Thanks

Bill
#clickbank #programmers #question
  • Profile picture of the author Mark Ford
    Hi
    Yes it does send them through on live transactions - see my sample capture below (info masked to protect):

    Date of Bug: Sep 01, 2010 01:30:06 am GET: Array ( ) POST: Array ( [ccustname] => xxxxx
    [ccustemail] => xxx@hotmail.com [ccustcc] => CA [ccuststate] => BC [ctransreceipt] => 11111 [ctransaction] => RFND [ctransaffiliate] => mavxzxcd [ctranspublisher] => csxelite01 [ctranspaymentmethod] => PYPL [ctransamount] => -4436 [cproditem] => 2 [cprodtype] => RECURRING [cprodtitle] => [caffitid] => [cvendthru] => detail=Cash_System_X_Elite_& [cverify] => xxxxx11 [ctranstime] => 1283319008 ) A lot of things don't work in TEST mode - the integration we do with clickbank we do it slightly different and run it through our own php scripts.
    {{ DiscussionBoard.errors[2693323].message }}
    • Profile picture of the author mywebwork
      Awesome Mark, thank you so much for your quick response! And exactly the answer I was looking for too!

      Originally Posted by Mark Ford View Post

      A lot of things don't work in TEST mode - the integration we do with clickbank we do it slightly different and run it through our own php scripts.
      Do you mean to say that you use scripts that emulate ClickBank? I'm curious to know more - on PayPal I'm spoiled by the sandbox facilities, would love to have similar tools with ClickBank.

      Thanks again

      Bill
      {{ DiscussionBoard.errors[2693396].message }}
      • Profile picture of the author Mark Ford
        Do you mean to say that you use scripts that emulate ClickBank?
        No, sorry for the confusion there. We set the Instant Notification Url to point to our php script and take what we want from there and then actually integrate this into WHMCS - to automatically add clients via the api - it gets kind of technical so I won't bore you with all the rest of it

        We have integrated Clickbank with WHMCS and also Infusionsoft and then threw in EasyClickmate into the mix as well - works well.

        Happy to help - if you need anything else - give me a yell
        {{ DiscussionBoard.errors[2693420].message }}
  • Profile picture of the author mywebwork
    OK, now I understand - actually we are working with something similar, I'm using the response to create client ID's for a custom application. Wanted the referring affiliate ID as I want to encode future links to that client with the ID so the affiliate is also credited for future purchases from that customer.

    Thanks again for your response, nice to see that someone else here works with ClickBank Instant Notification.

    Don't suppose you've found any good web resources for developers have you?



    Bill
    {{ DiscussionBoard.errors[2693434].message }}
    • Profile picture of the author jminkler
      Originally Posted by mywebwork View Post

      Wanted the referring affiliate ID as I want to encode future links to that client with the ID so the affiliate is also credited for future purchases from that customer.
      Now there's a novel idea that seems to be a lost art form around here these days ..

      :-D
      {{ DiscussionBoard.errors[2714444].message }}
  • Profile picture of the author circus_freak
    use

    function cbValid()
    { $key='YOUR SECRET KEY';
    $rcpt=$_REQUEST['cbreceipt'];
    $time=$_REQUEST['time'];
    $item=$_REQUEST['item'];
    $cbpop=$_REQUEST['cbpop'];

    $xxpop=sha1("$key|$rcpt|$time|$item");
    $xxpop=strtoupper(substr($xxpop,0,8));

    if ($cbpop==$xxpop) return 1;
    else return 0;
    }
    {{ DiscussionBoard.errors[2714643].message }}
  • Profile picture of the author thebizbuilder
    [DELETED]
    {{ DiscussionBoard.errors[2945533].message }}
    • Profile picture of the author novasoft
      First time im trying out clickbanks instant notification and compared to Paypal's IPN this is like pulling teeth..

      So I have my IPN handler code ready based on their sample code. I enter my secret key and IPN url into the "My site" page, select ver 2.1 in the drop down and then click test.

      The hash that I generate and what the cverify contains is different. No idea whats up. Anybody have any idea?

      @Mark: Will the hashes match only on live transactions?

      My code for reference ( Ive tried this both in vb.net as well as php)

      PHP Code:


      function ipnVerification() {




          
      $secretKey="MY SECRET KEY";

          
      $pop "";

          
      $ipnFields = array();

          foreach (
      $_POST as $key => $value) {
              if (
      $key == "cverify") {
                  continue;
              }
              
      $ipnFields[] = $key;
          }

          
      sort($ipnFields);

          foreach (
      $ipnFields as $field) {
                      
      // if Magic Quotes are enabled $_POST[$field] will need to be
              // un-escaped before being appended to $pop
              
      $pop $pop $_POST[$field] . "|";
          }
          
      $pop $pop $secretKey;

       
      $buf=$pop;

          
      $calcedVerify sha1(mb_convert_encoding($pop"UTF-8"));
          
      $calcedVerify strtoupper(substr($calcedVerify,0,8));
          return 
      $calcedVerify == $_POST["cverify"];



      VB.net

      Code:
      <%@ Page validateRequest="true" Language="VB" debug="true"%>
      <%@ Import Namespace="System.Data" %>
      <%@ Import Namespace="System.Data.OleDb" %>
      <%@ Import Namespace="System.Security.Cryptography" %>
      <%@ Import Namespace="System.IO" %>
      <%@ Import Namespace="System.Text" %>
      <%@ Import Namespace="System.Web" %>
      <%@ Import Namespace="System.Net.Mail" %>
      <%@ Import Namespace="System.Net" %>
      <%@ Import Namespace="System.Collections.Generic" %>
      
      <script runat="server" language="vb">
      
      public Function ipnVerification(request as HttpRequest)
      
      
      
      
      	Dim secretKey as String = " MY SECRET KEY"
      
      	   Dim ipnFields as New ArrayList()
      
      	    dim param as string, field as string
      
      	Dim sha As New SHA1CryptoServiceProvider()
      
      	   For Each param In request.Form.Keys()
      	   if param.Equals("cverify") then Continue For
      	   ipnFields.Add(param)
      	   Next
      
      	   ipnFields.Sort()
      
      	   Dim pop as String = ""
      
      	  For Each field in ipnFields
      		   pop += request.Form.Get(field) + "|"
      	   Next
      
      	   pop += secretKey
      
      
      
      	   dim cverify as string=request.Form("cverify")
      
      
      
      	   Dim result() As Byte = sha.ComputeHash(New System.Text.ASCIIEncoding().GetBytes(pop))
      
      	   Dim calced_verification As String = BitConverter.ToString(result).Replace("-", "").ToUpper().Substring(0, 8)
      
      
      
      	   Return calced_verification.Equals(cverify)
      
      
      
      End Function
      
      </script>


      Example of what clickbank actually sends me

      Values of keys sent back:100|USD||||||testuser@somesite.com|Test|Test User|User||||||||100||399|A passed in title|STANDARD||||TEST||VISA|softdiff|********|VEN DOR|1306149974||

      cverify sent was:23DF976D

      Calculated hash was:110C1C87

      Any help would be appreciated

      Thanks
      Satya
      {{ DiscussionBoard.errors[3935185].message }}
  • Profile picture of the author SteveJohnson
    I've never had trouble with it - but you do need to verify that magic quotes is off. Or you can just use this, it's pretty fast:


    PHP Code:
    if ( get_magic_quotes_gpc() ) {
        function 
    stripslashes_gpc( &$ value ) {
           $ 
    value stripslashes( $ value );
        }
        
    array_walk_recursive( $ _POST'stripslashes_gpc' );

    As usual, remove spaces from var names.

    How'd you get the post editor to leave the variable names alone?

    BTW, we try not to resurrect old threads like this. Just make a new thread with your question next time
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[3935696].message }}
    • Profile picture of the author novasoft
      Originally Posted by SteveJohnson View Post

      I've never had trouble with it - but you do need to verify that magic quotes is off. Or you can just use this, it's pretty fast:


      PHP Code:
      if ( get_magic_quotes_gpc() ) {
          function 
      stripslashes_gpc( &$ value ) {
             $ 
      value stripslashes( $ value );
          }
          
      array_walk_recursive( $ _POST'stripslashes_gpc' );

      As usual, remove spaces from var names.

      How'd you get the post editor to leave the variable names alone?

      BTW, we try not to resurrect old threads like this. Just make a new thread with your question next time
      Thanks for your comments, but have already tried it with stripslashes and without it. Same result. And in case of the vb.net code magic quotes is irrelevant.

      Any ideas?
      {{ DiscussionBoard.errors[3936915].message }}
  • Profile picture of the author ussher
    Also finding this exact same issue, using the same PHP

    function i
    pnVerification() {

    as novasoft above gained from clickbank here Instant Notification Service

    when clickbank sends me [cverify] => 88385424 i calculate it to be 5C7F1086

    so the check fails. Novasoft did you get it working?
    Signature

    "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

    - jamroom.net
    Download Jamroom free: Download
    {{ DiscussionBoard.errors[5401164].message }}
    • Profile picture of the author novasoft
      Originally Posted by ussher View Post

      Also finding this exact same issue, using the same PHP

      function i
      pnVerification() {

      as novasoft above gained from clickbank here Instant Notification Service

      when clickbank sends me [cverify] => 88385424 i calculate it to be 5C7F1086

      so the check fails. Novasoft did you get it working?

      Unfortunately No, so i ended up using plimus and after their recent paypal integration fiasco, ive moved to iPortis and so far their service has been stellar.

      I would however love to find a working solution to the clickbank API if anybody has it .

      Thanks
      {{ DiscussionBoard.errors[5419496].message }}
  • Profile picture of the author hchavda
    Originally Posted by mywebwork View Post

    Hi

    I'm building an application that makes use of ClickBank's payment notification service. The code to work with this seems straightforward, however I have run into a mystery that I was hoping someone could shed some light upon.

    I'm capturing the payment notification message and storing the results in a database, and that seems to work. I captured the test data that you can generate from the ClickBank site, and also have been capturing test purchases made before submitting a product for approval.

    All seems to work, but when I try to simulate a test purchase made with an affiliate I don't seem to get the affiliate name in the response, even though there is a field for it. I also don't get the affiliate name in the e-mail ClickBank sends after the purchase, so I'm wondering if this is just because I am in test mode?

    I know ClickBank is aware of the affiliate, as I see the affiliate ID on the payment page and the amount that I earn is half what it is without the affiliate ID attached (and the affiliate gets 50% so that is correct). But I don't get the affiliate ID in my payment notification response.

    If anyone knows why this is happening please let me know. Do I need to use one of the ClickBank API's after the transaction to get the affiliate ID? Or is what I'm seeing only because I am still in test mode? Is there any way to simulate an actual transaction (like a "sandbox environment")?

    Also, I looked for a ClickBank developers forum and couldn't find one, at least not on ClickBanks site. Does anyone know a forum or good resource for ClickBank developers? The amount of information I've been able to find is minimal - quite a contrast from working with the PayPal IPN.

    Thanks

    Bill
    Hello,

    I am with software development company.Currently assigned work is Ad-trackz and use of this project is click bank api.

    The use of this api is to display test order data in click bank are also display in our personal website.

    so click bank api is to use test sales order display data in our site and store data in database online.

    i also study all of click bank tutorial,forum but not working.

    you give forum information is you are display click bank test order data in our site so i ask my question is you.

    please give reply.

    Thank you
    Hardik Chavda
    {{ DiscussionBoard.errors[5417683].message }}
  • Profile picture of the author ussher
    @novasoft: actually yeah, i kept looking and found this: How To Set Up Email Notifications for ClickBank Sales - ClickScoop

    Its very similar to the function retrieved from clickbank, but it has a section specifically for the TEST ipn that comes in. Which points to the test cverify not being correct for the test ipn transmission.

    @hchavda this is a _very_ old thread, but it just happened to be so perfectly exactly what i needed to know that I brought it back to life. You would be better off asking a new question.

    needed the answer to this:
    Originally Posted by novasoft View Post

    ...The hash that I generate and what the cverify contains is different. No idea whats up. Anybody have any idea?
    Signature

    "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

    - jamroom.net
    Download Jamroom free: Download
    {{ DiscussionBoard.errors[5422266].message }}
    • Profile picture of the author novasoft
      Originally Posted by ussher View Post

      @novasoft: actually yeah, i kept looking and found this: How To Set Up Email Notifications for ClickBank Sales - ClickScoop

      Its very similar to the function retrieved from clickbank, but it has a section specifically for the TEST ipn that comes in. Which points to the test cverify not being correct for the test ipn transmission.
      So i take it you still haven't tested this on a live transaction?
      {{ DiscussionBoard.errors[5428640].message }}
      • Profile picture of the author ussher
        Originally Posted by novasoft View Post

        So i take it you still haven't tested this on a live transaction?
        Not yet on a live transaction but i have just found something real interesting. The verification was failing for me from the test link on the 'test' from the MY SITE link on clickbank:
        h t t p s ://ACCOUNT_ID.accounts.clickbank.com/account/siteEdit.htm?action=general

        BUT.... it is not failing when i do a test product.

        So if i go to the products page:
        h t t p s ://ACCOUNT_ID.accounts.clickbank.com/account/products.htm

        and set up a product, before i get the product authorized im able to run some test purchases. Clickbank gives me a test credit card number during the setup.

        In this way the verification does not fail. Its working. It gives me confidence. Hope this is useful to you too.
        Signature

        "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

        - jamroom.net
        Download Jamroom free: Download
        {{ DiscussionBoard.errors[5523756].message }}
        • Profile picture of the author bjarvie
          Can anyone suggest some open source scripting for interacting with clickbanks IPN for extensive reporting - optins and managing subscriptions/licensing ?

          Thanks in advance
          Signature
          http://www.onlineincomeguru.com Download 30 Different Traffic Generation Strategies INSTANTLY !!!
          {{ DiscussionBoard.errors[6477233].message }}
  • Profile picture of the author hchavda
    Hello,

    I am with software development company.Currently assigned work is Ad-trackz and use of this project is click bank api.

    The use of this api is to display test order data in click bank are also display in our personal website.

    so click bank api is to use test sales order display data in our site and store data in database online.

    i also study all of click bank tutorial,forum but not working.

    you give forum information is you are display click bank test order data in our site so i ask my question is you.

    please give reply.

    Thank you
    Hardik Chavda
    {{ DiscussionBoard.errors[5433654].message }}
  • Profile picture of the author sreedevi
    [DELETED]
    {{ DiscussionBoard.errors[9594842].message }}
    • Profile picture of the author michael_gourlay
      v6 is working for me with the sample code from the website and using the testing functionality from clickbank, though I haven't put the script live yet for real data.
      {{ DiscussionBoard.errors[9595078].message }}
      • Profile picture of the author behnampmdg3
        Originally Posted by michael_gourlay View Post

        v6 is working for me with the sample code from the website and using the testing functionality from clickbank, though I haven't put the script live yet for real data.
        I have set this and it works fine but the The only thing that is not yet working is the verification.
        This returns false no matter what
        if(ipnVerification())
        I am using the ipnVerification function from the link you have provided above (https://support.clickbank.com/entrie...n-Service#CODE)
        Could it be because I am on test mode?
        {{ DiscussionBoard.errors[9876550].message }}

Trending Topics