Skip to content

arifulalam/ClickBank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

ClickBank® API Library

Initialize:

first of all have to include this file

include('clickbank.php');

Then create an object of clickbank class

$clickbank = new ClickBank(array(
    'account' 	=> 'ACCOUNT_NAME',
    'api_key' 	=> 'API-KEY',
    'dev_key' 	=> 'DEV-KEY',
    'secret_key'=> 'SECRET_KEY'
    )
  );

where,
ACCOUNT_NAME = ClickBank® Account Name (Selling a/c) item_id.account.pay.clickbank.net
API-KEY = API Key that available in ClickBank® Master A/c
DEV-KEY = DEV key that available in ClickBank® Account (selling a/c) SETTINGS -> My Account -> Developer API Keys
SECRET_KEY = Available in ClickBank® Account (selling a/c) SETTINGS -> My Site -> Advanced Tools

After creating object will be able to call functions

To get all the orders of an email

$orders = $clickbank->getOrderByEmail('email@domain.com');
print_r($orders);

To get all the transactions of given receipt

$orders = $clickbank->getOrderByReceipt('XXXYYYZZZ', SKU);
print_r($orders);

where,
XXXYYYZZZ = Receipt number (required)
SKU = receipt product/item ID/SKU (optional)

To get all the orders of given item id/sku

$orders = $clickbank->getOrderByItemID(SKU);
print_r($orders);

where,
SKU = receipt product/item ID/SKU (optional)

To get all the orders of given Date(s)

$orders = $clickbank->getOrderByDate(startDate, endIDate);
print_r($orders);

where,
startDate = The beginning date for the search (yyyy-mm-dd)
endDate = The end date for the search (yyyy-mm-dd) (optional) if not given, current date will be used.

To get order by ClickBank® specific parameters

Parameters are optional. If parameter(s) given, then matching orders will be returned. Otherwise all orders will be returned.

$params = array(
    'startDate' => date('Y-m-d', strtotime('-1 week')),
    'endDate' 	=> date('Y-m-d', strtotime('-1 day')),
    'type' 	=> 'SALE', //SALE / RFND / CGBK / FEE / BILL / TEST_SALE / TEST_BILL / TEST_RFND /TEST_FEE
    'email' 	=> 'ariful-alam@hotmail.com',
    'item' 	=> 1
    'vendor' 	=> 'VENDOR_NAME',
    'affiliate' => 'AFFILIATE_NAME',
    'lastName' 	=> 'CUSTOMER_LAST_NAME',
    'tid' 	=> 'TRACKING ID/ PROMO CODE',
    'role' 	=> 'VENDOR', //VENDOR / AFFILIATE
    'postalCode'=> 'CUSTOMER_POSTAL/ZIP_CODE',
    'amount' 	=> 'TOTAL_TRANSACTION_AMOUNT'
  );
$orders = $clickbank->getOrderByParam($params);
print_r($orders);

$orders = $clickbank->getOrderByParam();
print_r($orders);

where
startDate = The beginning date for the search (yyyy-mm-dd)
endDate = The end date for the search (yyyy-mm-dd)
NOTE: If startDate is given but not endDate, then current date will be used as endDate. If endDate is given but not startDate, then endDate will be removed from given parameters.
type = The type of transactions to be returned. Supported types are [SALE / RFND / CGBK / FEE / BILL / TEST_SALE / TEST_BILL / TEST_RFND / TEST_FEE]. If not specified all types will be returned. If an invalid type is specified, no transactions will be returned.
email = The email of the customer. Supports wildcard searches using the '%' character. (Wildcards are converted to %25 after url encoding is done by the client)
item = ClickBank® product sku
vendor = The vendor name. Supports wildcard searches using the '%' character. (Wildcards are converted to %25 after url encoding is done by the client)
affiliate = The affiliate name. Supports the word 'none' to search for transactions without affiliates, and wildcard searches using the '%' character. (Wilcards are converted to %25 after url encoding is done by the client)
lastName = Customers last name. Supports wildcard searches using the '%' character. (Wildcards are converted to %25 after url encoding is done by the client)
tid = The TID (Tracking ID / Promo Code) to search on. This will search both vendor and affiliate tracking codes and be returned in the promo field
role = Role account was of transaction options are [VENDOR, AFFILIATE]
postalCode = Customer's zip or postal code. Supports wildcard searches.
amount = The transaction total amount

To count total orders of given email

$orders = $clickbank->getOrderCountByEmail('email@domain.com');
print_r($orders);

To count total orders of given Date(s)

$orders = $clickbank->getOrderByDate(startDate, endIDate);
print_r($orders);

where,
startDate = The beginning date for the search (yyyy-mm-dd)
endDate = The end date for the search (yyyy-mm-dd) (optional) if not given, current date will be used.

To count total orders of given parameters

Parameters are optional. If parameter(s) given, then matching orders will be returned. Otherwise all orders will be returned.

$params = array(
    'startDate' => date('Y-m-d', strtotime('-1 week')),
    'endDate' 	=> date('Y-m-d', strtotime('-1 day')),
    'type' 	=> 'SALE', //SALE / RFND / CGBK / FEE / BILL / TEST_SALE / TEST_BILL / TEST_RFND /TEST_FEE
    'email' 	=> 'ariful-alam@hotmail.com',
    'item' 	=> 1
    'vendor' 	=> 'VENDOR_NAME',
    'affiliate' => 'AFFILIATE_NAME',
    'lastName' 	=> 'CUSTOMER_LAST_NAME',
    'tid' 	=> 'TRACKING ID/ PROMO CODE',
    'role' 	=> 'VENDOR', //VENDOR / AFFILIATE
  );
$orders = $clickbank->getOrderCountByParam($params);
print_r($orders);

$orders = $clickbank->getOrderCountByParam();
print_r($orders);

where
startDate = The beginning date for the search (yyyy-mm-dd)
endDate = The end date for the search (yyyy-mm-dd)
NOTE: If startDate is given but not endDate, then current date will be used as endDate. If endDate is given but not startDate, then endDate will be removed from given parameters.
type = The type of transactions to be returned. Supported types are [SALE / RFND / CGBK / FEE / BILL / TEST_SALE / TEST_BILL / TEST_RFND / TEST_FEE]. If not specified all types will be returned. If an invalid type is specified, no transactions will be returned.
email = The email of the customer. Supports wildcard searches using the '%' character. (Wildcards are converted to %25 after url encoding is done by the client)
item = ClickBank® product sku
vendor = The vendor name. Supports wildcard searches using the '%' character. (Wildcards are converted to %25 after url encoding is done by the client)
affiliate = The affiliate name. Supports the word 'none' to search for transactions without affiliates, and wildcard searches using the '%' character. (Wilcards are converted to %25 after url encoding is done by the client)
lastName = Customers last name. Supports wildcard searches using the '%' character. (Wildcards are converted to %25 after url encoding is done by the client)
tid = The TID (Tracking ID / Promo Code) to search on. This will search both vendor and affiliate tracking codes and be returned in the promo field
role = Role account was of transaction options are [VENDOR, AFFILIATE]

To check given recurring receipt product is active or not

$orders = $clickbank->getOrderStatus('XXXYYYZZZ', SKU);
print_r($orders);

where,
XXXYYYZZ = Recurring product's receipt number
SKU = Specific product/item ID/SKU (optional)
will return 0 if not active or 1 if active.

(will continue to update this doc...)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages