ClickBetter Integeration

What is offered

We will describe in detail how you can integrate MQLLock with This description is for beginners and will cover Automatic adding clients and automatic removing refunded clients. For now this Post is using ORDERID as Authentication string.

What is IPN

IPN is Instant Payment Notification, IPN makes possible that ClickBetter clients´s scripts get notified automatically upon new order has been received or someone has requested refund. With IPN its possible to automate sales and refunds and re-act almost realtime. You will not need any manual interaction anymore if you have setuped IPN Backend. Typically IPN is a script hosted on your server, you have to tell ClickBetter about your URL and ClickBetter will send data to this url internally. Your clients (person who has purchased the product) does not see anything, everything happens automatically in background


You need a valid ClickBetter account, if you dont have an Account, you can Signup one here. You will need api2.php file from MQLLock Downloads section. See details about api2 here. Knowledge about PHP is required to make modifications or you have someone who understands PHP basics. You will also need a hosting with Pear::Mail Enabled PHP and FTP Account to upload files.


Upload api2.php and single.php to your hosting, edit single.php with your settings (see Video). Assume your domain is ‘’, we recommend you to create a subfolder ‘/ipn’ and put ‘single.php’ into this folder. Your IPN Url would be ‘’. Then you will have to define a “Vendor Secret ID” (check video). Lets assume you have defined it as ‘VN12345678’ then your IPN Url would be ‘’. The “Vendor Secret ID” is used as authentication, to make sure noone hits your single.php directly and creates any clients without paying.

Introduction Video


Receipt number licencing makes you possible to have a free defineable authentication token. We call this licencing method Receipt Number because most of Affiliate Platforms such as ClickBank have unique but more complex Receipt number (Example: AJ42SXWQ), this number can be used to define auth token, because only buyer can know this receipt number. You can then say your clients “Login with Receipt number of your purchase”. In case of ClickBetter we are using OrderID to demonstrate. OrderID at ClickBetter is too simple and it looks like easy to guess. You could for example email address of client as receipt number token.

if ($TYPE=="sale")
{ $NewClient = array("receipt" => $ORDERID,"client_email" => $CLIENTEMAIL,
"comment" => $IPN);

You see at this location that we use $ORDERID, you can modify this token to something else. Its very hard for someone to know which email address has purchased your product. So Patch would look like:

if ($TYPE=="sale")
$NewClient = array(
"receipt" => $CLIENTEMAIL,
"client_email" => $CLIENTEMAIL,
"comment" => $IPN);

Accordingly refund patch would be like this:

if ($TYPE=="refund")
// -- Lets first find that client by $ORDERID
$FoundClients = $api->findClients(mlApi::LICENSE_RECEIPT

URL Security

IPN URL Should be kept private and it should not be defined very obvious like We recommend you make it tricky url so not many people can guess it

ClickBetter IPN Docs

ClickBetter has some IPN Documentation available here


Its quite easy to test at ClickBetter, please check our Introduction video for video demonstration how to test your IPN. You can generate a test Credit Card and make a purchase with it to simulate an IPN


IPN is very important and you should not miss any errors or mistakes. Thats why we have prepared very detailed Debugging Output. You will receive from that script very detailed output as email per session. A Session is 1 IPN Transaction. We recommend you to check these logs in detail first weeks to find problems.


Script here is working for many purphoses, but you might need to modify/extend this script to adapt to other needs. For this you will need to understand php and mqllock api coding. This script covers almost everything to get started for normal marketting needs. Advanced users can modify it as they need.


If you aren´t PHP developer you can hire a freelancer to do this job, he will be able to understand everything after reviewing this page and api2 page. Also make sure this person watches introduction video to get started


You can download files here

Tagged with: , , , ,
Posted in MQLLock Updates