public function pay($iid, $returnURL = "order/index.php") { global $dbh, $postvar, $getvar, $instance; require_once INC . "/paypal/paypal.class.php"; $paypal = new paypal_class(); $invoices_data = $dbh->select("invoices", array("id", "=", $iid)); if ($_SESSION['cuser'] == $invoices_data['uid']) { if ($dbh->config("paypalmode") == "sandbox") { $paypal->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; $paypal->add_field('business', $dbh->config('paypalsandemail')); } else { $paypal->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; $paypal->add_field('business', $dbh->config('paypalemail')); } $paypal->add_field('return', $dbh->config('url') . "client/index.php?page=invoices"); $paypal->add_field('cancel_return', $dbh->config('url') . "client/index.php?page=invoices"); $paypal->add_field('notify_url', $dbh->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid); $paypal->add_field('item_name', 'THT Order: ' . $invoices_data['notes']); $paypal->add_field('amount', $invoices_data['pay_now']); $paypal->add_field('currency_code', $dbh->config("currency")); $paypal->submit_paypal_post(); } else { echo "You don't seem to be the person who owns that invoice!"; exit; } }
public function content() { # Displays the page global $style, $db, $main, $invoice, $server; if ($_GET['invoiceID']) { require_once "../includes/paypal/paypal.class.php"; $paypal = new paypal_class(); if ($paypal->validate_ipn()) { $invoice->set_paid(mysql_real_escape_string($_GET['invoiceID'])); $main->errors("Your invoice has been paid!"); $client = $db->fetch_array($db->query("SELECT * FROM `<PRE>user_packs` WHERE `userid` = '{$_SESSION['cuser']}'")); if ($client['status'] == '2') { $server->unsuspend($client['id']); } } else { $main->errors("Your invoice hasn't been paid!"); } } // List invoices. :) $query = $db->query("SELECT * FROM `<PRE>invoices` WHERE `uid` = '{$_SESSION['cuser']}' ORDER BY `id` ASC"); $userdata = mysql_fetch_row($db->query("SELECT `user`,`firstname`,`lastname` FROM `<PRE>users` WHERE `id` = {$_SESSION['cuser']}")); $domain = mysql_fetch_row($db->query("SELECT `domain` FROM `<PRE>user_packs` WHERE `userid` = {$_SESSION['cuser']}")); $extra = array("userinfo" => "{$userdata['2']}, {$userdata['1']} ({$userdata['0']})", "domain" => $domain[0]); $array2['list'] = ""; while ($array = $db->fetch_array($query)) { $array['due'] = strftime("%D", $array['due']); $array["paid"] = $array["is_paid"] == 1 ? "<span style='color:green;font-size:20px;'>Paid</span>" : "<span style='color:red;font-size:20px;'>Unpaid</span>"; $array["pay"] = $array["is_paid"] == 0 ? '<input type="button" name="pay" id="pay" value="Pay Now" onclick="doswirl(\'' . $array['id'] . '\')" />' : ''; $array['amount'] = $array['amount'] . " " . $db->config("currency"); $array2['list'] .= $style->replaceVar("tpl/invoices/invoice-list-item.tpl", array_merge($array, $extra)); } $array2['num'] = mysql_num_rows($query); echo $style->replaceVar("tpl/invoices/client-page.tpl", $array2); }
public function ValidateNotification($txn_id = null) { parent::ValidateNotification($txn_id); $paypal = new paypal_class(); $paypal->paypal_mail = $config['account']; $result = $paypal->validate_ipn(); return $result; }
public function load() { $AppConfig = $GLOBALS['AppConfig']; $p = new paypal_class(); $m = new PaymentModel(); if (!isset($_GET['action']) || empty($_GET['action'])) { $GLOBALS['_GET']['action'] = "process"; } switch ($_GET['action']) { case "process": return; case "success": if ($this->isPost()) { echo "<html><head><title>Success</title></head><body><h3>Thank you for your order.</h3>"; $m->dispose(); echo "</body></html>"; } break; case "cancel": echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>"; echo "</body></html>"; break; case "ipn": if ($p->validate_ipn()) { break; } $subject = "Instant Payment Notification - Recieved Payment"; $to = $AppConfig['system']['email']; $body = "An instant payment notification was successfully recieved\n"; $body .= "from " . $p->ipn_data['payer_email'] . " on " . date("m/d/Y"); $body .= " at " . date("g:i A") . "\n\nDetails:\n"; foreach ($p->ipn_data as $key => $value) { $body .= "\n{$key}: {$value}"; } @mail($to, $subject, $body); $usedPackage = NULL; foreach ($AppConfig['plus']['packages'] as $package) { if ($package['cost'] == $p->ipn_data['payment_gross']) { $usedPackage = $package; } } $Player = base64_decode($p->ipn_data['custom']); $m = new PaymentModel(); $m->incrementPlayerGold($Player, $usedPackage); $m->dispose(); } }
/** * Pays an invoice * */ public function pay($invoice_id, $returnURL = "order/index.php") { global $db, $main, $order; require_once "paypal/paypal.class.php"; $paypal = new paypal_class(); $invoice_info = $this->getInvoiceInfo($invoice_id); $user_id = $main->getCurrentUserId(); $order_id = $this->getOrderByInvoiceId($invoice_id); $order_info = $order->getOrderInfo($order_id); if (!empty($invoice_info)) { if ($user_id == $invoice_info['uid']) { if ($db->config('paypal_mode') == PAYPAL_STATUS_LIVE) { $paypal->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; } else { $paypal->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } //More infor for paypal variables : https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside $paypal->add_field('business', $db->config('paypalemail')); // Will only work if Auto Return is set in the Paypal account $paypal->add_field('return', urlencode($db->config('url') . "client/index.php?page=invoices&sub=view&p=success&do={$invoice_id}")); // Paypal Sucess $paypal->add_field('cancel_return', urlencode($db->config('url') . "client/index.php?page=invoices&sub=view&p=cancel&do=" . $invoice_id)); // Paypal Cancel $paypal->add_field('notify_url', urlencode($db->config('url') . "includes/paypal/ipn.php?do=" . $invoice_id)); // IPN $paypal->add_field('item_name', $db->config('name') . ' - ' . $order_info['real_domain'] . ' Invoice id: ' . $invoice_id); $paypal->add_field('invoice', $invoice_id); //When trying to buy something with the same Invoice id Paypal will send a message that the invoice was already done $paypal->add_field('no_note', 0); $paypal->add_field('no_shipping', 1); $paypal->add_field('continue_button_text', 'Continue >>'); $paypal->add_field('cbt', 'Continue >>'); $paypal->add_field('background_color', ''); //""=white 1=black $paypal->add_field('display_shipping_address', '1'); //""=yes 1=no $paypal->add_field('display_comment', '1'); //""=yes 1=no //Image is 150*50px otherwise the image will not work //@todo add a new paypal parameter to the URL image //$paypal->add_field('image_url', 'http://demo.contidos.cblue.be/logo-beez.png'); $paypal->add_field('amount', $invoice_info['total_amount']); $paypal->add_field('currency_code', $db->config('currency')); $main->addLog("invoice::pay Invoice #{$invoice_id} Order #{$order_id} Total amount: {$invoice_info['total_amount']}"); $paypal->submit_paypal_post(); // submit the fields to paypal } else { echo "You don't seem to be the person who owns that invoice!"; } } }
public function pay($iid, $returnURL = "order/index.php") { global $db; require_once "paypal/paypal.class.php"; $paypal = new paypal_class(); $query = $db->query("SELECT * FROM `<PRE>invoices` WHERE `id` = '{$iid}'"); $array = $db->fetch_array($query); if ($_SESSION['cuser'] == $array['uid']) { $paypal->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; $paypal->add_field('business', $db->config('paypalemail')); $paypal->add_field('return', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . csrf_get_tokens()); $paypal->add_field('cancel_return', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . rawurlencode(csrf_get_tokens())); $paypal->add_field('notify_url', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . rawurlencode(csrf_get_tokens())); $paypal->add_field('item_name', $db->config('name') . ': ' . $array['notes']); $paypal->add_field('amount', $array['amount']); $paypal->add_field('currency_code', $db->config("currency")); $paypal->submit_paypal_post(); // submit the fields to paypal } else { echo "You don't seem to be the person who owns that invoice!"; } }
function dealPayment($data, $total, $ids) { $customsettings = array('cpp_header_image' => WEBSITE_IMG_URL . "logo2.jpg", 'page_style' => "paypal", 'cbt' => __("To complete your order Go Back to " . Configure::read('Site.title'))); // pr($customsettings); die; $nvpArray = array_merge($customsettings); //$nvp = http_build_query($nvpArray); foreach ($nvpArray as $param => $value) { $paramsJoined[] = "{$param}={$value}"; } $nvp = implode('&', $paramsJoined); $p = new paypal_class(); if (Configure::read('Payment.paypal_sandbox')) { $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr/' . $nvp; } else { $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr/' . $nvp; } $this_script = Router::url(array('plugin' => 'invoice', 'controller' => 'invoices', 'action' => 'paypal_response'), true); $paypal_success = Router::url(array('plugin' => 'invoice', 'controller' => 'invoices', 'action' => 'paypal_response'), true); $paypal_cancle = Router::url(array('plugin' => 'invoice', 'controller' => 'invoices', 'action' => 'paypal_response'), true); $i = 1; // $p->add_field('cmd','_xclick');//type cart $p->add_field('cmd', '_cart'); //type cart $p->add_field('upload', '1'); // multiple orders $p->add_field('username', Configure::read('Payment.PaypalUsername')); //$_POST['paypalemail'] $p->add_field('business', Configure::read('Payment.paypal_email')); //$owner_paypal_email $p->add_field('return', $paypal_success); $p->add_field('cancel_return', $paypal_cancle); $p->add_field('notify_url', $this_script . '?action=ipn'); $p->add_field('currency_code', PAYPAL_CURRENCY_CODE); $p->add_field('os0', PAYPAL_CURRENCY_CODE); foreach ($data as $key => $value) { $p->add_field('item_name_' . ($key + 1), $value['title']); $p->add_field('amount_' . ($key + 1), $value['amount']); $p->add_field('shipping_' . ($key + 1), $value['shipping_cost']); $p->add_field('quantity_' . ($key + 1), $value['qty']); } $p->add_field('custom', $ids["id"]); $p->submit_paypal_post(); exit; }
function pay($code) { // echo '<pre>'; // print_r($_POST); // exit; // echo base_url() . 'classes/pay/' . $code . '?action=ipn'; // exit; ini_set('display_errors', 'On'); $this->load->model('classesmodel'); $event = $this->classesmodel->getOneEvent($code); $this->load->library('paypal_class'); $desc = $this->input->post('desc', TRUE); $p = new paypal_class(); // initiate an instance of the class //$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url $this_script = createUrl('classes/pay/' . $code); $ipn_url = 'http://www.sew2it.co.uk/classes/pay/' . $code; $qty = gParam('qty'); if (empty($_GET['action'])) { $_GET['action'] = 'process'; } switch ($_GET['action']) { case 'process': // Process and order... // e($invoice); // $paypal_id = getConfig('PAYPAL_MERCHENT_EMAIL'); $paypal_id = getConfig('PAYPAL_ID'); $p->add_field('business', $paypal_id); $p->add_field('return', $this_script . '?action=success'); $p->add_field('cancel_return', $this_script . '?action=cancel'); $p->add_field('notify_url', base_url() . 'classes/pay/' . $code . '?action=ipn&qty=' . $qty . '&user_id=' . curUsrId() . '&id=' . $code); // $p->add_field('ipn_notification_url', $ipn_url); $p->add_field('amount', $event['price']); $p->add_field('item_name', $desc); $p->add_field('quantity', $qty); $p->add_field('currency_code', 'GBP'); $p->add_field('custom', $code); $p->add_field('event_id', $event['id']); // echo '<pre>'; // print_r($p); // exit; $p->submit_paypal_post(); // submit the fields to paypal //$p->dump_fields(); // for debugging, output a table of all the fields break; case 'success': // Order was successful... $shell = array(); $shell['contents'] = $this->load->view('classes-index', array(), true); $this->load->view("themes/" . THEME . "/templates/subpage", $shell); // foreach ($_POST as $key => $value) { // echo "$key: $value<br>"; // } break; case 'cancel': // Order was canceled... // The order was canceled before being completed. // echo "This is Cancelled"; redirect(base_url() . "booking-cancelled"); exit; //header("Location:http://wwww.sew2it.co.uk/booking-cancelled"); // echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>"; // echo "</body></html>"; break; case 'ipn': // Paypal is calling page for IPN validation... //error_log(json_encode($_REQUEST),3,'mytest.log'); if ($p->validate_ipn()) { // mail('*****@*****.**', 'subject', 'this is message'); $in_code = $this->input->get('id', TRUE); $user_id = $this->input->get('user_id', TRUE); $qty = $this->input->get('qty', TRUE); $this->db->insert('order', array('response' => json_encode($_REQUEST), 'status' => 'Active', 'event_id' => $in_code, 'user_id' => $user_id, 'qty' => $qty)); // echo $this->db->last_query(); } else { // $this->db->insert('test', array('value' => json_encode($_REQUEST))); } break; } }
function paypal() { require_once 'paypal.class.php'; // include the class file if (isset($_POST['sub'])) { $plan = explode('##', $_POST['plan']); $amt = $plan[0]; $p_id = $plan[1]; $this->load->model('Plan_Model'); $query = $this->Plan_Model->plan($p_id); $desc = $query[0]->plan_desc; $p = new paypal_class(); // initiate an instance of the class $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url $total_amt = $this->uri->segment(3); $total_amt = $this->uri->segment(3); $this_script = $this->config->item('base_url'); if (empty($_GET['action'])) { $_GET['action'] = 'process'; } switch ($_GET['action']) { case 'process': // Process and order... $p->add_field('business', '*****@*****.**'); $p->add_field('return', $this_script . 'payment/thanks'); $p->add_field('cancel_return', $this_script . 'payment/cancel'); $p->add_field('notify_url', $this_script . 'action=ipn'); $p->add_field('item_name', $desc); $p->add_field('custom', '24'); $p->add_field('amount', $amt); $p->add_field('currency_code', 'USD'); $p->submit_paypal_post(); // submit the fields to paypal //$p->dump_fields(); // for debugging, output a table of all the fields break; case 'success': // Order was successful... $response = $_POST; echo "<html><head><title>Success</title></head><body><h3>Thank you for your order.</h3>"; foreach ($_POST as $key => $value) { print_r($value); } //echo "$key: $value<br>"; } echo "</body></html>"; die; break; case 'cancel': // Order was canceled... // The order was canceled before being completed. echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>"; echo "</body></html>"; break; case 'ipn': // Paypal is calling page for IPN validation... if ($p->validate_ipn()) { $subject = 'Instant Payment Notification - Recieved Payment'; $to = '*****@*****.**'; // your email $body = "An instant payment notification was successfully recieved\n"; $body .= "from " . $p->ipn_data['payer_email'] . " on " . date('m/d/Y'); $body .= " at " . date('g:i A') . "\n\nDetails:\n"; foreach ($p->ipn_data as $key => $value) { $body .= "\n{$key}: {$value}"; } mail($to, $subject, $body); } break; } } die; }
$promote_ads1 = $_POST['promote_ads1']; $promote_ads2 = $_POST['promote_ads2']; $promote_ads3 = $_POST['promote_ads3']; $promote_ads4 = $_POST['promote_ads4']; $promote_high = $_POST['high']; $promote_top = $_POST['top']; $promote_sider = $_POST['sidebar']; $promote_slider = $_POST['home']; $promote_home = $_POST['topfeature']; $user_id = $_POST['user_id']; define('EMAIL_ADD', $city_your); // define any notification email define('PAYPAL_EMAIL_ADD', '*****@*****.**'); // facilitator email which will receive payments change this email to a live paypal account id when the site goes live require_once "paypal_class.php"; $p = new paypal_class(); // paypal class $p->admin_mail = EMAIL_ADD; // set notification email $action = $_REQUEST["action"]; switch ($action) { case "process": // case process insert the form data in DB and process to the paypal $allowedExts = array("gif", "jpeg", "jpg", "png"); $extension = end(explode(".", $_FILES["file"]["name"])); if ($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/jpg" || $_FILES["file"]["type"] == "image/pjpeg" || $_FILES["file"]["type"] == "image/x-png" || $_FILES["file"]["type"] == "image/png" || $_FILES["file"]["size"] < 1000000 && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>";
<?php require_once "db_connect.php"; //require_once ("profile.common.php"); require_once 'include/localization.class.php'; require_once "include/astercrm.class.php"; require_once 'include/paypal.class.php'; // include the class file $locate = new Localization('en', 'US', 'profile'); $p = new paypal_class(); // initiate an instance of the class $p->paypal_url = $config['epayment']['paypal_payment_url']; if ($p->validate_ipn($config['epayment']['ipn_log'])) { // Payment has been recieved and IPN is verified. This is where you // update your database to activate or process the order, or setup // the database with the user's order details, email an administrator, // etc. You can access a slew of information via the ipn_data() array. // Check the paypal documentation for specifics on what information // is available in the IPN POST variables. Basically, all the POST vars // which paypal sends, which we send back for validation, are now stored // in the ipn_data() array. // For this example, we'll just email ourselves ALL the data. if ($p->ipn_data['custom'] != '') { $payer = explode(':', $p->ipn_data['custom']); $userid = $payer['0']; $uesrtype = $payer['1']; $resellerid = $payer['2']; $groupid = $payer['3']; if ($config['epayment']['ipn_log']) { $loghandle = fopen("upload/paypalipn-epayment.log", 'rb'); $oricontent = fread($loghandle, filesize("upload/paypalipn-epayment.log"));
<?php session_start(); require_once 'config.php'; require_once 'classes.php'; require_once 'paypal.class.php'; // include the class file $m = new MoneyStuff(); $p = new paypal_class(); // initiate an instance of the class $p->paypal_url = $url_pay; // testing paypal url //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php') $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; // if there is not action variable, set the default action of 'process' if (empty($_GET['action'])) { $_GET['action'] = 'process'; } switch ($_GET['action']) { case 'process': // Process and order... //Generate hash $hash = md5($_SESSION['user_profile']['id'] . time() . "EsEHPayPaLdame1leuro"); $secure = md5($hash . PAYPAL_SECRET_HASH); $amount_b = $_GET['amount_c']; $amount = round($_GET['amount_c'] * PAYPAL_FARE_PER, 2) + PAYPAL_FARE_FIX; $currency = $_GET['currency']; $to_user_id = $_GET['to_user_id']; $insert_paypal = mysql_query("INSERT INTO `paypal_payments` (`id` ,`hash` ,`amount` ,`user_id` ,`status` ,`date`,`currency`)VALUES (\nNULL , '" . $hash . "', '" . $amount_b . "', '" . $_SESSION['user_profile']['id'] . "', '0', CURRENT_TIMESTAMP,'" . $currency . "');"); $p->add_field('business', $account_pay);
<?php require_once "library.php"; // include the library file define('EMAIL_ADD', '*****@*****.**'); // define any notification email define('PAYPAL_EMAIL_ADD', '*****@*****.**'); // facilitator email which will receive payments change this email to a live paypal account id when the site goes live require_once "paypal_class.php"; $p = new paypal_class(); // paypal class $p->admin_mail = EMAIL_ADD; // set notification email $action = $_REQUEST["action"]; switch ($action) { case "process": // case process insert the form data in DB and process to the paypal $add = $_POST['payer_add1'] . $_POST['payer_add2']; mysql_query("INSERT INTO `purchases` (`invoice`, `company` , `product_id`, `product_name`, `product_quantity`, `product_amount`, `payer_fname`, `payer_lname`, `payer_address`, `payer_city`, `payer_state`, `payer_zip`, `payer_country`, `payer_email`, `payment_status`, `posted_date`, `phone`, `mobile`, `fax`) VALUES \n\t\t('" . $_POST["invoice"] . "', '" . $_POST["company"] . "','" . $_POST["product_id"] . "', '" . $_POST["product_name"] . "', '" . $_POST["quantity"] . "', '" . $_POST["product_amount"] . "', '" . $_POST["payer_fname"] . "', '" . $_POST["payer_lname"] . "', '" . $add . "', '" . $_POST["payer_city"] . "', '" . $_POST["payer_state"] . "', '" . $_POST["payer_zip"] . "', '" . $_POST["payer_country"] . "', '" . $_POST["payer_email"] . "', 'pending', NOW(), '" . $_POST["phone"] . "', '" . $_POST["mobile"] . "', '" . $_POST["fax"] . "')"); $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $p->add_field('business', PAYPAL_EMAIL_ADD); // Call the facilitator eaccount $p->add_field('cmd', $_POST["cmd"]); // cmd should be _cart for cart checkout $p->add_field('upload', '1'); $p->add_field('return', $this_script . '?action=success'); // return URL after the transaction got over $p->add_field('cancel_return', $this_script . '?action=cancel'); // cancel URL if the trasaction was cancelled during half of the transaction $p->add_field('notify_url', $this_script . '?action=ipn'); // Notify URL which received IPN (Instant Payment Notification)
<?php include "../../_setup.php"; include "classes/donate-paypalclass.php"; include "classes/donation.php"; include "classes/campaign.php"; $donationPlugin = new btPlugin($mysqli); if ($donationPlugin->selectByName("Donations")) { $donationObj = new Donation($mysqli); $p = new paypal_class(); $arrColumns = array("donationcampaign_id", "member_id", "name", "message", "datesent", "amount", "paypalemail", "transaction_id", "response"); $p->setMode($donationPlugin->getConfigInfo("mode")); if ($p->validate_ipn() && $p->ipn_data['payment_status'] != "Failed" && $p->ipn_data['payment_status'] != "Denied") { $member = new Member($mysqli); $campaignObj = new DonationCampaign($mysqli); $arrData = $p->ipn_data; $data = json_encode($arrData); $customVars = json_decode($arrData['custom'], true); if ($campaignObj->select($customVars['campaign_id']) && $member->select($customVars['member_id'])) { $campaignName = $campaignObj->get_info_filtered("title"); $medalID = $campaignObj->get_info("awardmedal"); $member->awardMedal($medalID, "Donated to " . $campaignName . " campaign"); } $arrValues = array($customVars['campaign_id'], $customVars['member_id'], $customVars['name'], $customVars['message'], time(), $arrData['mc_gross'], $arrData['payer_email'], $arrData['txn_id'], $data); $donationObj->addNew($arrColumns, $arrValues); } else { $data = json_encode($p->ipn_data); $data = "ERROR: - " . $p->last_error . " - " . $data; $donationObj->logError($data); } }
<?php /** * paypal.php * * @version 1.0 * @copyright 2008 by Anthony for XNova Redesigned */ //paypal email $paypal_email = "*****@*****.**"; //$paypal_email = "*****@*****.**"; // Setup class require_once 'paypal.class.php'; // include the class file $p = new paypal_class(); // initiate an instance of the class $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php') $this_script = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; function logerror_mr($time, $error, $sql, $file) { $newrow = $time . "," . $error . "," . $file . "," . $sql . "\n"; $csv = fopen('paypal_error.csv', 'a'); fwrite($csv, $newrow); fclose($csv); } //Costs. if ($_GET['amount'] == 1000000) { $amount = 1000000; $cost = $darkmattercosts[1000];
<?php echo __DIR__; $seller_account_email = '*****@*****.**'; $seller_account_email = '*****@*****.**'; require_once __DIR__ . '/paypal.class.php'; // include the class file $p = new paypal_class(); // initiate an instance of the class //$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php') $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; // if there is not action variable, set the default action of 'process' if (empty($_GET['action'])) { $_GET['action'] = 'process'; } switch ($_GET['action']) { case 'process': // Process and order... // There should be no output at this point. To process the POST data, // the submit_paypal_post() function will output all the HTML tags which // contains a FORM which is submited instantaneously using the BODY onload // attribute. In other words, don't echo or printf anything when you're // going to be calling the submit_paypal_post() function. // This is where you would have your form validation and all that jazz. // You would take your POST vars and load them into the class like below, // only using the POST values instead of constant string expressions. // For example, after ensureing all the POST variables from your custom // order form are valid, you might have:
* payment notification (IPN) interface. This single file serves as 4 * virtual pages depending on the "action" varialble passed in the URL. It's * the processing page which processes form data being submitted to paypal, it * is the page paypal returns a user to upon success, it's the page paypal * returns a user to upon canceling an order, and finally, it's the page that * handles the IPN request from Paypal. * * I tried to comment this file, aswell as the acutall class file, as well as * I possibly could. Please email me with questions, comments, and suggestions. * See the header of paypal.class.php for additional resources and information. */ //die("Script Not in use"); // Setup class include ("scripts/vsys.php"); require_once ('paypal.class.php'); // include the class file $p = new paypal_class; // initiate an instance of the class //$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php') $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; // if there is not action variable, set the default action of 'process' if (empty($_GET['action'])) $_GET['action'] = 'display'; switch ($_GET['action']) { case 'display': if (!$_SESSION['isLogined']) { header("Location: index.php"); exit; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?php require "config.php"; $show_form = 1; $mess = ""; // Para en envío de la forma if (!empty($_POST["process"]) && $_POST["process"] == "yes") { if (!empty($_POST["amount"]) && is_numeric($_POST["amount"])) { $amount = !empty($_POST["amount"]) ? strip_tags(str_replace("'", "", $_POST["amount"])) : ''; $show_form = 0; require_once 'paypal.class.php'; $paypal = new paypal_class(); $paypal->add_field('business', $store_email); $paypal->add_field('return', $script_location . '?action=success'); $paypal->add_field('cancel_return', $script_location . '?action=cancel'); $paypal->add_field('notify_url', $script_location . '?action=ipn'); $paypal->add_field('item_name_1', strip_tags(str_replace("'", "", $_POST["description"]))); $paypal->add_field('amount_1', $amount); $paypal->add_field('item_number_1', $item_id); $paypal->add_field('quantity_1', '1'); $paypal->add_field('custom', $_SERVER['REMOTE_ADDR']); $paypal->add_field('upload', 1); $paypal->add_field('cmd', '_cart'); $paypal->add_field('txn_type', 'cart'); $paypal->add_field('num_cart_items', 1); $paypal->add_field('payment_gross', $amount); $paypal->add_field('currency_code', strip_tags(str_replace("'", "", $_POST["currency"]))); $paypal->submit_paypal_post(); // submit the fields to paypal $show_form = 0; } elseif (!is_numeric($_POST["amount"]) || empty($_POST["amount"])) {
function CallOrder() { global $USER, $CONF, $UNI; $this->amount = HTTP::_GP('amount', 0); $this->cost = HTTP::_GP('cost', 0); if (!array_key_exists($this->amount, $this->pattern)) { message('NOT VALID VALUE', '?page=overview', 3); exit; } $this->cost = $this->pattern[$this->amount]; $validationKey = md5(uniqid('2m')); $GLOBALS['DATABASE']->query("INSERT INTO `uni1_paypal` (`id`, `player`, `amount`, `timestamp`, `price`) VALUES (NULL, '" . $USER['id'] . "', '" . $this->amount . "', '" . TIMESTAMP . "', '" . $this->cost . "');"); //SendSimpleMessage ( $USER['id'], $USER['id'], TIMESTAMP, 1, 'Payment Bot', 'To do', 'After the payment has been processed, if you didnt received your DM please send an ticket or an Private Message to "Admin"'); $this_p = new paypal_class(); $ID = $GLOBALS['DATABASE']->uniquequery("SELECT `id` FROM `uni1_paypal` WHERE `player` = '" . $USER['id'] . "' AND `amount` = '" . $this->amount . "' AND `timestamp` = '" . TIMESTAMP . "'"); $this_p->add_field('business', $this::MAIL); $this_p->add_field('return', 'https://' . $_SERVER['HTTP_HOST'] . '/game.php?page=paypal&i=' . $validationKey . ''); $this_p->add_field('cancel_return', 'https://' . $_SERVER['HTTP_HOST'] . '/ipn.php'); $this_p->add_field('notify_url', 'https://' . $_SERVER['HTTP_HOST'] . '/ipn.php'); $this_p->add_field('item_name', $this->amount . ' Credit-User(' . $USER['username'] . ').'); $this_p->add_field('item_number', $this->amount . '_credits'); $this_p->add_field('amount', $this->cost); //$this_p->add_field('action', $action); ? $this_p->add_field('currency_code', 'EUR'); $this_p->add_field('custom', $USER['id'] . ',' . $validationKey); $this_p->add_field('rm', '2'); //$this_p->dump_fields(); foreach ($this_p->fields as $name => $value) { $field[] = array('text' => '<input type="hidden" name="' . $name . '" value="' . $value . '">'); } $this->tplObj->assign_vars(array('fields' => $field)); $this->display('paypal_class.tpl'); }
* to aid in the interfacing between your website, paypal, and the instant * payment notification (IPN) interface. This single file serves as 4 * virtual pages depending on the "action" varialble passed in the URL. It's * the processing page which processes form data being submitted to paypal, it * is the page paypal returns a user to upon success, it's the page paypal * returns a user to upon canceling an order, and finally, it's the page that * handles the IPN request from Paypal. * * I tried to comment this file, aswell as the acutall class file, as well as * I possibly could. Please email me with questions, comments, and suggestions. * See the header of paypal.class.php for additional resources and information. */ // Setup class require_once('paypal.class.php'); // include the class file $p = new paypal_class; // initiate an instance of the class $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php') //$this_script = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $this_script = "http://landlord.webnseo.co.uk/test/paypal.php"; // if there is not action variable, set the default action of 'process' if (empty($_GET['action'])) $_GET['action'] = 'process'; switch ($_GET['action']) { case 'process': // Process and order... // There should be no output at this point. To process the POST data, // the submit_paypal_post() function will output all the HTML tags which
<?php require_once "init.php"; require_once "config_db.php"; require_once "include/paypal_class.php"; $p = new paypal_class(); // paypal class $p->admin_mail = EMAIL_ADD; // set notification email if (isset($_SESSION[formdata])) { $action = $_SESSION[formdata]["action"]; } else { if (isset($_POST)) { $action = 'success'; } } if ($_GET['action'] == 'cancel') { $action = 'cancel'; } switch ($action) { case "process": // case process insert the form data in DB and process to the paypal mysql_query("INSERT INTO `customers` (`invoice`,`quantity`,`amount`,`payment_status`,`posted_date`,`time`) VALUES ( '" . $_SESSION[formdata][invoice] . "','" . $_SESSION[formdata][no_shipping] . "','" . $_SESSION[formdata][shipping] . "','pending', NOW() ,'" . time() . "')"); $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $p->add_field('business', PAYPAL_EMAIL_ADD); // Call the facilitator eaccount $p->add_field('cmd', '_xclick'); // cmd should be _cart for cart checkout $p->add_field('upload', '1'); $p->add_field('return', WEB_URL . '?action=success'); // return URL after the transaction got over
<?php require "paypal_integration_class/paypal.class.php"; require "config.php"; require "connect.php"; $p = new paypal_class(); $p->paypal_url = $payPalURL; if ($p->validate_ipn()) { if ($p->ipn_data['payment_status'] == 'Completed') { $amount = $p->ipn_data['mc_gross'] - $p->ipn_data['mc_fee']; $userid = $_SESSION["id"]; mysql_query("\tINSERT INTO dc_donations (transaction_id,donor_email,amount,original_request)\r\n\t\t\t\t\t\tVALUES (\r\n\t\t\t\t\t\t\t'" . esc($p->ipn_data['txn_id']) . "',\r\n\t\t\t\t\t\t\t'" . esc($p->ipn_data['payer_email']) . "',\r\n\t\t\t\t\t\t\t" . (double) $amount . ",\r\n\t\t\t\t\t\t\t'" . esc(http_build_query($_POST)) . "'\r\n\t\t\t\t\t\t)"); mysql_query("UPDATE accounts SET security = '2' WHERE id = '" . $userid . "'"); } } function esc($str) { global $link; return mysql_real_escape_string($str, $link); }
<?php session_start(); include "includes/db.conn.php"; include "includes/conf.class.php"; include "includes/mail.class.php"; $row_default_lang = mysql_fetch_assoc(mysql_query("select * from bsi_language where `lang_default`=true")); include "languages/" . $row_default_lang['lang_file']; $paymentGatewayDetails = $bsiCore->loadPaymentGateways(); $bsiMail = new bsiMail(); $emailContent = $bsiMail->loadEmailContent(); require_once 'paypal.class.php'; // include the class file $invoice = time(); $p = new paypal_class(); // initiate an instance of the class //$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php') $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; // if there is not action variable, set the default action of 'process' if (empty($_GET['action'])) { $_GET['action'] = 'process'; } switch ($_GET['action']) { case 'process': // Process and order... $p->add_field('business', $paymentGatewayDetails['pp']['account']); $p->add_field('return', $this_script . '?action=success'); $p->add_field('cancel_return', $this_script . '?action=cancel');
// Setup class include_once "includes/SystemConfiguration.class.php"; include "includes/language.php"; global $systemConfiguration; global $logger; $logger->LogInfo(__FILE__); $systemConfiguration->assertReferer(); $logger->LogInfo("Loading payment gateway for code 'pp' ..."); $paypalPaymentGateway = PaymentGateway::fetchFromDbForCode("pp"); if ($paypalPaymentGateway == null) { $logger->LogError("Payment gateway could not be found!"); header('Location: booking-failure.php?error_code=9'); } $emailSender = new EmailSender(); require_once 'paypal.class.php'; $p = new paypal_class(); $p->paypal_url = $paypalPaymentGateway->getUrl(); // 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url // 'https://www.paypal.com/cgi-bin/webscr'; // paypal url // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php') $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; // if there is not action variable, set the default action of 'process' if (empty($_GET['action'])) { $_GET['action'] = 'process'; } switch ($_GET['action']) { case 'process': // Process and order... $logger->LogInfo("Procesisng request for payment to PayPal ..."); $p->add_field('business', $paypalPaymentGateway->account); $p->add_field('return', $this_script . '?action=success');
* handles the IPN request from Paypal. * * If you want submit a payment form to Paypal sandbox. Please add the * _GET[sandbox=1] parameter to link. ie: paypal.php?sandbox=1. * * I tried to comment this file, aswell as the acutall class file, as well as * I possibly could. Please email me with questions, comments, and suggestions. * See the header of paypal.class.php for additional resources and information. */ define('EMAIL_ADD', 'YOUR EMAIL ADDRESS HERE'); // For system notification. define('PAYPAL_EMAIL_ADD', 'YOUR PAYPAL OR SANDBOX EMAIL ADDRESS HERE'); // Setup class require_once 'paypal_class.php'; // include the class file $p = new paypal_class(); // initiate an instance of the class. $p->admin_mail = EMAIL_ADD; //$p -> paypal_mail = PAYPAL_EMAIL_ADD; // If set, class will verify the receiver. switch ($_GET['action']) { default: // Process and order... // There should be no output at this point. To process the POST data, // the submit_paypal_post() function will output all the HTML tags which // contains a FORM which is submited instantaneously using the BODY onload // attribute. In other words, don't echo or printf anything when you're // going to be calling the submit_paypal_post() function. // adds or edits a "$p->add_field(key, value);" in following, which is what will be // sent to paypal as POST variables. Refer to PayPal HTML Variables: // https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables // This is where you would have your form validation and all that jazz.
* See the header of paypal.class.php for additional resources and information. */ //if ((!is_numeric($_REQUEST['id']) or !isset($_REQUEST['id'])) and !isset($_REQUEST['action'])) { // die("<h1>What are you doing here ?</h1>"); //} //error_reporting(0); @require_once('paypal.class.php'); // include the class file $dm = new docmanpaypal(); if (!$dm->constructRun) { $dm->__construct(); } extract($dm->cfg); $p = new paypal_class; // initiate an instance of the class //TODO: Da se mahnat si4ki mysql_query... i taka, shtoto mahnah gore connection-a. //$paypalbusiness = mysql_result(mysql_query("select value from $mosConfig_dbprefix" . "docmanpaypalconfig where name = 'paypalemail'"),0); //$notifyemail = mysql_result(mysql_query("select value from $mosConfig_dbprefix" . "docmanpaypalconfig where name = 'notifyemail'"),0); //$sandbox = mysql_result(mysql_query("select value from $mosConfig_dbprefix" . "docmanpaypalconfig where name = 'sandbox'"),0); if ($sandbox == 'No') { $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; } else { $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } $componentdir = 'components/com_docmanpaypal'; // if there is not action variable, set the default action of 'process' $request_action = JRequest::getVar('action');
//$quantity_arrays = explode(",", $voucher_quantity_array); //$size_quantity = sizeof($id_arrays); //echo "<br>"; //for ($i=0; $i < $size; $i++) { // echo "ID Array: ".$id_arrays[$i]; // echo "<br>"; //} $invoice = date("His") . rand(1234, 9632); //$voucher_quantity = $_POST["product_quantity"]; require_once "library.php"; // include the library file //define('EMAIL_ADD', '*****@*****.**'); // define any notification email define('PAYPAL_EMAIL_ADD', '*****@*****.**'); // facilitator email which will receive payments change this email to a live paypal account id when the site goes live require_once "paypal_class.php"; $p = new paypal_class(); // paypal class $action = $_REQUEST["action"]; switch ($action) { case "voucher_purchase": // case process insert the form data in DB and process to the paypal $voucher_id_array = $_POST["voucher_id_array"]; $size_id = explode(",", $voucher_id_array); $voucher_value_array = $_POST["voucher_value_array"]; $values = explode(",", $voucher_value_array); /*$from_array = $_POST["from_array"]; $from_values = explode(",", $from_array); $from_email_array = $_POST["from_email_array"]; $from_email_values = explode(",", $from_email_array); $from_contact_array = $_POST["from_contact_array"]; $from_contact_values = explode(",", $from_contact_array);*/
global $wp_query; $pid = $wp_query->query_vars['jobid']; $action = $_GET['action']; global $current_user; get_currentuserinfo(); $uid = $current_user->ID; $post = get_post($pid); //-------------------------------------------------------------------------------- $busi = get_option('PricerrTheme_paypal_email'); if (empty($busi)) { echo 'ERROR: please input your paypal address in backend'; exit; } //-------------------------------------------------------------------------------- include 'paypal.class.php'; $p = new paypal_class(); // initiate an instance of the class $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // testing paypal url $sdb = get_option('PricerrTheme_paypal_enable_sdbx'); if ($sdb == "yes") { $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } // paypal url global $wpdb; $this_script = get_bloginfo('siteurl') . '/?pay_for_item=paypal&jobid=' . $pid; if (empty($action)) { $action = 'process'; } switch ($action) { case 'process':
<?php include 'paypal.class.php'; global $wp_query, $wpdb, $current_user; $pid = $wp_query->query_vars['pid']; get_currentuserinfo(); $uid = $current_user->ID; $post = get_post($pid); $action = $_GET['action']; $business = trim(get_option('ProjectTheme_paypal_email')); if (empty($business)) { die('Error. Admin, please add your paypal email in backend!'); } $p = new paypal_class(); // initiate an instance of the class $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // testing paypal url //-------------- $ProjectTheme_paypal_enable_sdbx = get_option('ProjectTheme_paypal_enable_sdbx'); if ($ProjectTheme_paypal_enable_sdbx == "yes") { $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } // paypal url //-------------- $this_script = get_bloginfo('siteurl') . '/?p_action=paypal_listing&pid=' . $pid; if (empty($action)) { $action = 'process'; } switch ($action) { case 'process': // Process and order...
function pay($code) { ini_set('display_errors', 'On'); $this->load->library('paypal_class'); $invoice = $this->commonmodel->getByPk($code, 'invoice_new', 'invoice_code'); $applicant = $this->commonmodel->getByPk(arrIndex($invoice, 'applicant_id'), 'applicants', 'applicant_id'); $p = new paypal_class(); // initiate an instance of the class $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url $this_script = createUrl('invoice/pay/' . $code); $ipn_url = 'http://landlord.webnseo.co.uk/paypal'; if (empty($_GET['action'])) { $_GET['action'] = 'process'; } switch ($_GET['action']) { case 'process': // Process and order... // e($invoice); $paypal_id = getConfig('PAYPAL_MERCHENT_EMAIL'); $p->add_field('business', '*****@*****.**'); $p->add_field('return', $this_script . '?action=success'); $p->add_field('cancel_return', $this_script . '?action=cancel'); $p->add_field('notify_url', $ipn_url . '?action=ipn&invoice_id=' . $code); //$p->add_field('ipn_notification_url', $ipn_url); $p->add_field('item_name', 'Paypal Test Transaction'); $p->add_field('amount', arrIndex($invoice, 'total_amount')); $p->add_field('currency_code', 'GBP'); $p->add_field('custom', $code); $p->add_field('invoice_code', $code); $p->submit_paypal_post(); // submit the fields to paypal //$p->dump_fields(); // for debugging, output a table of all the fields break; case 'success': // Order was successful... $page = array(); $page['content'] = $this->load->view('thankyou', array(), true); $this->load->view($this->default, $page); // foreach ($_POST as $key => $value) { // echo "$key: $value<br>"; // } break; case 'cancel': // Order was canceled... // The order was canceled before being completed. echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>"; echo "</body></html>"; break; case 'ipn': // Paypal is calling page for IPN validation... //error_log(json_encode($_REQUEST)); if ($p->validate_ipn()) { $in_code = $this->input->get('invoice_id', TRUE); $this->db->insert('test', array('value' => json_encode($_REQUEST), 'status' => 1)); } else { // $this->db->insert('test', array('value' => json_encode($_REQUEST))); } break; } }