Jump to content

3rd Party Payment Processor Custom Add On


chatyak

Recommended Posts

I signed up for the free trial. I read the dev kit about adding my own module for payment processing. I want to use Clickbank in conjunction with WHMCS.

 

I understand the basic stuff - changing the template_ to a unique name, deleting the capture function per the instructions etc... but I don't know where to go from here.

 

What variables do I need from Clickbank in order to make this work?

 

Extra Info:

 

http://www.clickbank.com/help/affiliate-help/affiliate-tools/instant-notification-service/

 

http://www.clickbank.com/help/account-help/account-tools/clickbank-api/

 

So far this is what my template has...

 

 

<?php

 

function clickbank_config() {

$configarray = array(

"FriendlyName" => array("Type" => "System", "Value"=>"Clickbank"),

"username" => array("FriendlyName" => "Login ID", "Type" => "text", "Size" => "20", ),

"transmethod" => array("FriendlyName" => "Transaction Method", "Type" => "dropdown", "Options" => "Option1,Value2,Method3", ),

"instructions" => array("FriendlyName" => "Payment Instructions", "Type" => "textarea", "Rows" => "5", "Description" => "Do this then do that etc...", ),

"testmode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to test", ),

);

return $configarray;

}

 

function clickbank_link($params) {

 

# Gateway Specific Variables

$gatewayusername = $params['username'];

$gatewaytestmode = $params['testmode'];

 

# Invoice Variables

$invoiceid = $params['invoiceid'];

$description = $params["description"];

$amount = $params['amount']; # Format: ##.##

$currency = $params['currency']; # Currency Code

 

# Client Variables

$firstname = $params['clientdetails']['firstname'];

$lastname = $params['clientdetails']['lastname'];

$email = $params['clientdetails']['email'];

$address1 = $params['clientdetails']['address1'];

$address2 = $params['clientdetails']['address2'];

$city = $params['clientdetails']['city'];

$state = $params['clientdetails']['state'];

$postcode = $params['clientdetails']['postcode'];

$country = $params['clientdetails']['country'];

$phone = $params['clientdetails']['phonenumber'];

 

# System Variables

$companyname = $params['companyname'];

$systemurl = $params['systemurl'];

$currency = $params['currency'];

 

# Enter your code submit to the gateway...

 

$code = '<form method="http://www.domain.com/submit">

<input type="hidden" name="username" value="'.$gatewayusername.'" />

<input type="hidden" name="testmode" value="'.$gatewaytestmode.'" />

<input type="hidden" name="description" value="'.$description.'" />

<input type="hidden" name="invoiceid" value="'.$invoiceid.'" />

<input type="hidden" name="amount" value="'.$amount.'" />

<input type="submit" value="Pay Now" />

</form>';

 

return $code;

}

 

function clickbank_refund($params) {

 

# Gateway Specific Variables

$gatewayusername = $params['username'];

$gatewaytestmode = $params['testmode'];

 

# Invoice Variables

$transid = $params['transid']; # Transaction ID of Original Payment

$amount = $params['amount']; # Format: ##.##

$currency = $params['currency']; # Currency Code

 

# Client Variables

$firstname = $params['clientdetails']['firstname'];

$lastname = $params['clientdetails']['lastname'];

$email = $params['clientdetails']['email'];

$address1 = $params['clientdetails']['address1'];

$address2 = $params['clientdetails']['address2'];

$city = $params['clientdetails']['city'];

$state = $params['clientdetails']['state'];

$postcode = $params['clientdetails']['postcode'];

$country = $params['clientdetails']['country'];

$phone = $params['clientdetails']['phonenumber'];

 

# Card Details

$cardtype = $params['cardtype'];

$cardnumber = $params['cardnum'];

$cardexpiry = $params['cardexp']; # Format: MMYY

$cardstart = $params['cardstart']; # Format: MMYY

$cardissuenum = $params['cardissuenum'];

 

# Perform Refund Here & Generate $results Array, eg:

$results = array();

$results["status"] = "success";

$results["transid"] = "12345";

 

# Return Results

if ($results["status"]=="success") {

return array("status"=>"success","transid"=>$results["transid"],"rawdata"=>$results);

} elseif ($gatewayresult=="declined") {

return array("status"=>"declined","rawdata"=>$results);

} else {

return array("status"=>"error","rawdata"=>$results);

}

 

}

 

?>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated