Clickbank Instant notification

by dordor
6 replies
Hi guys

I'm trying to setup CB instant notification PHP script.

Found this one:
http://upto50.net/im-tutorials/updat...ickbank-sales/

I get a 'success' message from clickbank when I test it but no email are being sent.
Any ideas? Any other recommended scripts?
I do not really need the email but a script to get the sale details into my DB.

Any advise will be appreciated
#clickbank #instant #notification
  • Profile picture of the author Vikram73
    As a vendor? You get an email with the sale. You can use OptimizePress and other membership/WP themes to integrate directly and create accounts.

    As an affiliate, you can use Prosper202 to get notification of sales.
    {{ DiscussionBoard.errors[9923229].message }}
  • Profile picture of the author dordor
    Yes as a vendor.
    I get the email but I want to use the notification to be inserted in my DB.
    {{ DiscussionBoard.errors[9923350].message }}
  • Profile picture of the author emptee
    Can you post your PHP code here? I'll see what I can tell you

    Remember to remove your shared secret from it though...
    {{ DiscussionBoard.errors[9923954].message }}
  • Profile picture of the author dordor
    <?php

    /* YOUR ClickBank Secret Key */
    $secretKey = "YOUR SECRET KEY HERE";

    /* Email That Receives The Notification */
    $toEmail = "ENTER YOUR EMAIL ADDRESS HERE";

    /* Email That Sends The Notification */
    $fromEmail = "imdiscounts@clickbank.net<script cf-hash="f9e31" type="text/javascript">
    /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.leng th;e--if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2), 16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fr omCharCode(i);e=document.createTextNode(e),c.paren tNode.replaceChild(e,c) } catch(u){ } }();/* ]]> */</script>";
    $fromName = "IMDiscounts Notify";

    $message = json_decode(file_get_contents('php://input'));
    $encrypted = $message->{'notification'};
    $iv = $message->{'iv'};

    $decrypted = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128,
    substr(sha1($secretKey), 0, 32),
    base64_decode($encrypted),
    MCRYPT_MODE_CBC,
    base64_decode($iv)), "\0..\32");

    $json = json_decode($decrypted,true);

    $headers = "From: " . $fromName . " <" . $fromEmail . ">\r\n" .
    "Reply-To: " . $fromEmail . "\r\n" .
    "X-Mailer: PHP/" . phpversion();

    mail($toEmail, "New Transaction: " . ucfirst($json['transactionType']) . ": $" . number_format($json['totalAccountAmount'], 2, '.', ''),

    "\nProduct: " . $json['lineItems']['0']['productTitle'] .
    "\nVendor: " . $json['vendor'] .
    "\nReceipt: " . $json['receipt'] .
    "\nAffiliate: " . $json['affiliate'] .
    "\nAmount: $" . number_format($json['totalAccountAmount'], 2, '.', '') .
    "\nPayment: " . $json['paymentMethod'] .
    "\n\nhttp://IMDiscounts.Net - IM Discounts and Coupon Codes"
    , $headers);
    ?>


    Based on:
    Updated: How To Set Up Email Notifications for ClickBank Sales - Upto 50% OFF
    {{ DiscussionBoard.errors[9924620].message }}
  • Profile picture of the author dordor
    Found the problem

    All the code under $fromemail was creating the problem.

    Thanks for your help
    {{ DiscussionBoard.errors[9924641].message }}
  • Profile picture of the author emptee
    No problem mate - I should have noticed that! haha, doh!

    Glad to hear it's working
    {{ DiscussionBoard.errors[9924647].message }}

Trending Topics