Updated: How To Set Up Email Notifications for ClickBank Sales

IM Tutorials

1 Comment

Clickbank has perceptibly emerged to be the world’s largest marketplace for digital products with thousands of affiliates getting huge commissions on affiliate sales daily. But heck! Don’t you think it would be much easier and convenient for affiliates to be notified by email when they do get those commissions, rather than them having to log into their dashboard all the time to figure that out? Well the truth is this was actually an integral part of the Clickbank marketplace.

Yes it was, but for some reason, Clickbank dropped the commission notifications via email. This was a little excruciating as I’s a feature quite valued by affiliates to make life a little easier to deal with. Fortunately, there is still a way out of this dilemma and you can still actually get notified by email when you make Clickbank commissions. However this method requires using a script and it’s fairly simple to set up, anyone with a website can get it through and start receiving commission alerts straight into their inbox.

In this post, I am going to guide you through the process of setting up this script to do the work for you, but before we get to that, here are a few insights into the script.


You will need:

•    A ClickBank account
•    An email address (where your commission notifications will be directed to) and,
•    A web hosting account.

How it Works…

•    This script functions on the bases ClickBank’s Instant Notification Service.
•    Clickbank’s  Instant Notification Service instantly sends information to the script installed on your website each time you make a sale
•    Once the script receives the alert from Clickbank’s Instant Notification Service, it automatically wraps that up into an email and forwards it to your SPECIFIED email.

Additional Details…

•    Though only vendors still get notified by Clickbank on sales of their products, this script flawlessly works for all commissions relating to any Clickbank account, be it vendor and affiliate.
•    The script is not limited to only sales notifications, but other activities on your account such as sales, refunds, rebills, and rebills cancellations.
•    You have full rights to customize as you wish.
•    Though its actually possible to use SSL with ClickBank’s Instant Notification Service and this script, it’s  however not a prerequisite.


1. Copy the script below to NotePad, WordPad, or any HTML editor and save it as imdiscountsnotify.php


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

/* Email That Receives The Notification */

/* Email That Sends The Notification */
$fromEmail = "[email protected]";
$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($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\nhttps://imdiscounts.net  - IM Discounts and Coupon Codes"
, $headers);

2. Replace the following information in the script…

a)   Line 4 – You’ll need to create a secret key, this can be any series of up to 16 numbers and letters but must be in ALL UPPERCASE.  Replace “YOUR SECRET KEY HERE” with your new secret key.
b)   Line 7 – Replace “ENTER EMAIL ADDRESS HERE” with the email address you want your notifications sent to.

3. Upload the script to your website and note the path to the script.  For ex:

4. Enable “Instant Notification” in your ClickBank Account.

a. Log into your ClickBank account and click on the Settings tab.
clickbank settings

b. Click on “My Site.”
clickbank mysite

c. Under the “Advanced Tools” section click on “Edit.”
clickbank advanced tools

d. Under the “Advanced Tools Editor” click “request access.”
clickbank request

e. 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 and click on “Save Changes & Request API Access.”
clickbank savechanges

f. Enter your Secret Key.  This is the same secret key you created in Step 2a above.
clickbank secret key

g. Paste the path to your script into the field “Instant Notification URL 1:
clickbank notification url

h. Select version 6.0 from the drop-down.
clickbank version 6

i. Click the (test) link to test the script.
clickbank test

j. Click to Save Changes.
clickbank save changes

5. Make sales and get notified by email!

Script customization…

Here is a run-through of the scripts emailing format.

Email Subject –
New Transaction: (Transaction Type): $(Amount)
Body of email –
Product: (Title of product)
Vendor: (Product Vendor)
Affiliate: (Referring Affiliate) – This however only displays if  the scale is referred by the affiliate
Amount: $(Amount paid to you)

While it’s quite easy to push through with customizing the script to fit your liking, it would require a basic knowledge of PHP to achieve your desired customization. Not all that techy? You can simply outsource a PHP developer of freelancing sites like Fiverr or Elance for a few bucks to handle the script’s customization. However, all the post parameters available in Clickbank’s Instant Notification Version 6.0 will work just fine with this script and will sure help out where you get stuck!

•    Ensure your email address, Secret Key, and the Instant Notification URL are all correctly set.
•    Be sure to check both your inbox and spam folders for the mails sent to you as messages from the script may sometimes be marked by spam by your email provider’s authentication system.
•    Though this script is likely to work with any webhost, it’s advisable to verify with your web host that this script will work as some webhosts sometimes require a separate email process.

One Response to "Updated: How To Set Up Email Notifications for ClickBank Sales"

Leave a Reply