iredhostgo-pro
Welcome, Guest
Username Password: Remember me

[Paused]"ClickandBuy" payment method plugin
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: [Paused]"ClickandBuy" payment method plugin

[Paused]"ClickandBuy"​; payment method plugin 1 year, 5 months ago #15904

  • Sean
  • OFFLINE
  • Moderator
  • Friendly neighbourhood echidna
  • Posts: 2421
Another payment method plugin request here, this time for the (seemingly very) popular payment gateway "ClickandBuy". It's been referred to as the "European Paypal", so it seems like a good gateway to offer support for (could certainly boost redSHOP usage in Europe).

As usual, access to API developer documentation is available in this great PDF (I'll add more API resources as I discover them), and I've also discovered this great general PHP integration guide:


Get Instance of ClickandbuyAPI class and set class options

<?php
// Load class library
include_once("clickandbuyapi.php");


// Example Configurations:
$configs = array( 'gateway' => array(
'gateway_url' => 'eu.clickandbuy.com/newauth/http://premium-[your keys].eu.clickandbuy.com/',
'return_url' => 'www.yourwebsite.com/clickandbuy_return.php',
'sellerID' => 'your sellerId',
'tmPassword' => 'your tmPassword',
'dynkey' => '',
),
'customParams' => array('myUserId', 'myItemId'), // these parameters will be preserved.
);

// get instance
$api = ClickandbuyAPI::getInstance($configs);

?>


Generate Clickandbuy Link

<?php

// Get your ClickandBuy transaction parameters from database
$data = array(
'cb_currency' => 'EUR',
'lang' => 'en',
'cb_billing_Nation' => 'UK',
'price' => 100, // price in cent
'cb_content_name_utf' => 'Yurssite.com',
'cb_content_info_utf' => 'Yur product title',
'myUserId' => 10, // optional
'MyItemId' => 32, // optional
);

// Construct clickandbuy payment link
$url = $api->link($data);

// now you can use this link in html anchor like:
?>

<a href="<?php echo $url; ?>">Pay using ClickandBuy</a>


Check Your Transaction

Verify transaction information and store transaction data into your database with status uncommitted.

File: transaction_check.php

<?php
// verify transaction information and return all necessary data in array
$checkData = $api->check(false);

if (!empty($checkData)) {
// check and insert server transaction data into database.
/**
* ... database insert code here....
*/

// redirect to landing page for second handshake
header('Location: ' . $checkData['url']);
exit;
}
?>


Transaction Return Page

This page will call soap call isExternalBDRIDCommitted as second handshake to confirm the transaction.

File: transaction_return.php

<?php
// call soap method isExternalBDRIDCommitted and return all necessary information as array
$committed = $api->isCommitted();

if (!empty($committed)) {
// soap status
if ($committed['return'] == ture) {
/**
* ... update transaction as completed ....
*/

echo "Transaction successfull!";
} else {
/**
* ... update transaction as fault ....
*/

echo "Transaction cancelled";
}

$api->pr($committed); // dump result data

} else {
// other errors
echo "Transaction cancelled";

$api->pr($api->getErrors()); // dump errors for debug
}
?>


Tips

You can merge Transaction check and Transaction Return URL in same location. See the example below:

<?php
if (empty($_GET['result'])) {
// ... code for transaction check page ...
} else {
// ... code for transaction landing page ....
}
?>
Last Edit: 1 year, 4 months ago by BoFoght.

Re: "ClickandBuy" payment method plugin 1 year, 4 months ago #17822

  • BoFoght
  • OFFLINE
  • Moderator
  • Posts: 3361
Hi Sean. As you know our feature requests are on hold at the moment. So please bump this after we release version 1.1
When sending info mails please include:
1) website url 2) Joomla superadministrator useraname and password 3) a link to the thread where you have described the problem.

Please do NOT send private messages through the forum. I will most likely not see them
  • Page:
  • 1
Time to create page: 0.22 seconds