Any Clickbank programmers out there? Have a question!

by 19 replies
24
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
#programming #clickbank #programmers #question
  • Banned
    [DELETED]
  • 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.
    • [ 1 ] Thanks
    • [1] reply
    • Awesome Mark, thank you so much for your quick response! And exactly the answer I was looking for too!

      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
      • [1] reply
  • 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
    • [1] reply
    • Now there's a novel idea that seems to be a lost art form around here these days ..

      :-D
  • 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;
    }
  • [DELETED]
    • [1] reply
    • 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
  • 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
    • [1] reply
    • 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?
  • Also finding this exact same issue, using the same PHP
    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?
    • [1] reply

    • 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
  • 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
  • @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:
    • [1] reply
    • So i take it you still haven't tested this on a live transaction?
      • [1] reply
  • 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
  • [DELETED]
    • [1] reply
    • 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.
      • [1] reply

Next Topics on Trending Feed