function do_bill($amount, $title, $products, $u, $invoice)
 {
     global $config, $db;
     $product = $products[0];
     //list($a, $p, $t, $rebill_times) = $this->build_subscription_params($products, $amount, $u, $invoice);
     $vars = array('price' => intval($amount * 100), 'cb_currency' => $product['clickandbuy_currency'] ? $product['clickandbuy_currency'] : 'USD', 'cb_content_name_utf' => $title, 'payment_id' => $invoice, 'externalBDRID' => $invoice . '-' . $this->get_rand(3));
     $db->log_error("ClickAndBuy Debug: " . clickandbuy_get_dump($vars));
     $vars1 = array();
     foreach ($vars as $kk => $vv) {
         $v = urlencode($vv);
         $k = urlencode($kk);
         $vars1[] = "{$k}={$v}";
     }
     $vars = join('&', $vars1);
     //clickandbuy_subscription_id
     $purchase_code = $product['clickandbuy_subscription_id'] ? $product['clickandbuy_subscription_id'] : $this->config['purchase_code'];
     header("Location: http://premium-" . $purchase_code . ".eu.clickandbuy.com/clickandbuy.php?{$vars}");
     exit;
 }
Exemple #2
0
$amount = doubleval($amount / 1000 / 100);
// when price >= 100 (1.00 _) divide by 1000
// when price < 100 (0.01 _)  divide by 100000
$myprice = doubleval($vars['price'] / 100);
// 1000 = 10,00_ sent over the GET parameter
$ext_bdr_id = $vars["externalBDRID"];
//Your unique external transaction ID , this parameter is mandatory
function clickandbuy_error($msg)
{
    global $order_id, $payment_id, $pnref, $db;
    global $vars;
    $db->log_error("CLICKANDBUY ERROR: " . $msg);
    //$db->log_error(sprintf(_PLUG_PAY_CLICKANDBUY_FERROR, $msg, $pnref, $payment_id, '<br />')."\n".clickandbuy_get_dump($vars));
    //die($msg);
}
$db->log_error("CLICKANDBUY DEBUG: " . clickandbuy_get_dump($vars));
//////////////////////////////////////////////////////////////////////////////
//
//                           M   A   I   N
//
//////////////////////////////////////////////////////////////////////////////
$result = true;
$reason = '';
//Check Click&Buy UserID
if (empty($cb_uid) || clickandbuy_is_nan($cb_uid)) {
    $result = false;
    $reason .= "cb_uid&";
}
// check ip
if (!preg_match('/^217\\.22\\.128\\.\\d+/', $_SERVER['REMOTE_ADDR'])) {
    $result = false;