How To Set Up Email Notifications for ClickBank Sales

Updated: Oct. 15th, 2015 to work with ClickBank IPN Version 6.0

Rather than logging into your ClickBank account continually to see if you’ve made a sale, it’s much easier and convenient to receive an email informing you of one. Unfortunately, back in 2003 ClickBank discontinued sending email sale notifications to its affiliates. Although this feature is no longer available, there is still a way to receive email sale notifications. The method requires using a script and it’s fairly simple to set up, anyone with a website can do it. Below I provide you with a free script that will send you ClickBank sale notifications by email. But before I cover how to set it up, let’s go over some of the basics of the script.


  • A ClickBank account
  • An email address (to receive your sale notifications)
  • A web hosting account.

How it Works…

  • The script uses ClickBank’s Instant Notification Service.
  • When you make a sale, ClickBank’s Instant Notification Service sends the sale information to the script installed on your website.
  • The script then takes that sale information and puts it into an email and sends the email to whatever email address you’ve defined in the script.

Additional Details…

  • Although ClickBank still sends sale notifications by email to vendors, this script will work for all sales within a ClickBank account, including vendor and affiliate sales.
  • The script will send an email notification for sales, refunds, chargebacks, rebills, and rebill cancellations.
  • You have my permission to use this script freely and customize it however you’d like.
  • It’s possible to use SSL with ClickBank’s Instant Notification Service and this script, but it’s not required.


  1. Copy the script below to NotePad, WordPad, or any HTML editor and save it as clickscoopnotify.php
    //  VERSION 6.0
    $email_to = "ENTER EMAIL ADDRESS HERE";
    $email_from = "ClickScoop Notify <ENTER EMAIL ADDRESS HERE>";
    $secretKey = "ENTER SECRET KEY HERE";
    $rawData = file_get_contents("php://input");
    $json = json_decode($rawData, true);
    $notification = $json['notification'];
    $iv = $json['iv'];
    $notification = str_replace("\n","",$notification);
    $decrypted = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128,
                                     substr(sha1($secretKey), 0, 32),
                                     base64_decode($iv)), "\0..\32");
    $decrypted = trim($decrypted); //is not that important just for convience 
    $decrypted = utf8_encode($decrypted); //is important if you have certain special chars that will be decrypted
    $order = json_decode($decrypted);
    // Product Item
    $product = $order->lineItems[0];
    // Customer info
    $customer = $order->customer;
    $subject = "New Transaction: ".$order->transactionType.": $" . $order->totalAccountAmount;
    $message = "Transaction Time : ".$order->transactionTime."\n";
    $message  = "Product: ".$product->productTitle."\n";
    $message .= "Vendor: ".$order->vendor."\n";
    	$message.= "Affiliate: ".$order->affiliate."\n";
    	$message.= "Tracking ID: ".$order->trackingCodes->tracking_code."\n";
    	$message .= "Customer Name: " .$customer->shipping->fullName. "\n";
    	$message .= "Customer Email: " .$customer->shipping->email. "\n";
    $message .= "Amount: $".$order->totalAccountAmount."\n";
    $message .= "\n\n - The Community for ClickBank Vendors and Affiliates";
    $header = 'To: '.$email_fullname. "\r\n".
    	 'From: '.$email_from. "\r\n" .
         'Reply-To: '.$email_reply. "\r\n" .
         'X-Mailer: PHP/' . phpversion();
    	// Mail send
    	// Email not sending
  2. Replace the following information in the script…
    1. Line 7 and 8 – Replace ENTER EMAIL ADDRESS HERE with the email address you want your notifications sent to and from. Both fields can have the same email address.
    2. Line 9 – You’ll need to make up a secret key, this can be any series of up to 16 numbers and letters but must be in ALL UPPERCASE.  Replace ENTER SECRET KEY HERE with your new secret key.
  3. Upload the script to your website and note the path to the script.  For example
  4. Enable “Instant Notification” in your ClickBank Account.
    1. Log into your ClickBank account and click on the Settings tab.
    2. Click on “My Site.”
    3. Under the “Advanced Tools” section click on “Edit.”
    4. Under the “Advanced Tools Editor” click “request access.”
    5. Answer the questions and make sure you’ve reviewed the Terms of Use. You’ll need to scroll to the bottom as there is a checkbox at the end of the terms. Once you’ve agreed to the terms, click on “Save Changes & Request API Access.”
    6. Enter your Secret Key.  This is the same secret key you created in Step 2b above.
    7. Paste the path to your script into the field “Instant Notification URL”:
    8. Make sure version 6.0 is selected and click on TEST IPN. This will send a $1 test purchase notification. At this point you should receive an email. If not, check the steps above to make sure you’ve set everything up correctly.
    9. Click to Save Changes.

Further customization…

Currently, the script emails information in the following way…

Email Subject –
New Transaction: (Transaction Type): $(Amount)

Body of email –
Product: (Title of product)
Vendor: (Product Vendor)
Affiliate: (Referring Affiliate) – Only displays if affiliate referred the sale.
TID: (Tracking ID) – Only displays if there a TID is present.
Customer Name: (Customer Name) – Only displays if sale is made as a vendor.
Customer Email: (Customer Email Address) – Only displays if sale is made as a vendor.
Amount: $(Amount paid to you)

By editing the script, you can customize the information in numerous ways to fit your specific needs. All the post parameters available with ClickBank’s Instant Notification Version 6.0 will work with this script.  By editing the script you could display additional customer or transaction information, rebill info., product item numbers, and more.


  • Make sure to double check your email address, Secret Key, and the Instant Notification URL.
  • The sale notification email may be getting marked as spam, so make sure to check your spam folder.
  • Verify with your web host that this script will work. In rare cases a web host may require a different email process as in the case of RackSpace cloud hosting.
Leave a comment...