$street = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['postal_code'];
$desc = $_POST['item'];
$carId = $_POST['car_id'];
$caryear = $_POST['caryear'];
$make = $_POST['make'];
$model = $_POST['model'];
$first_name = $_POST['first_name'];
$name = $_POST['first_name'] + " " + $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['telephone'];
$country = $_POST['country'];
$price = $_POST['carprice'];
$exterior_color = $_POST['exterior_color'];
$interior_color = $_POST['interior_color'];
$trim = $_POST['trim'];
//Insert into temp table
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_SYL_NAME, $link) or die('Could not select database.');
$insertQuery = "INSERT INTO temp_car_detail_payment_info ( first_name, last_name, address, telephone, country, city,  postal_code,email, make, model, year, price, exterior_color, interior_color, trim ) VALUES( '" . mysql_real_escape_string($firstName) . "', '" . mysql_real_escape_string($lastName) . "', '" . mysql_real_escape_string($street) . "', '" . mysql_real_escape_string($phone) . "', '" . mysql_real_escape_string($country) . "', '" . mysql_real_escape_string($city) . "', '" . mysql_real_escape_string($zip) . "', '" . mysql_real_escape_string($email) . "', '" . mysql_real_escape_string($make) . "', '" . mysql_real_escape_string($model) . "', '" . mysql_real_escape_string($caryear) . "', '" . mysql_real_escape_string($price) . "', '" . mysql_real_escape_string($exterior_color) . "', '" . mysql_real_escape_string($interior_color) . "', '" . mysql_real_escape_string($trim) . "' )";
$result = mysql_query($insertQuery);
$lastid = mysql_query('select id from temp_car_detail_payment_info order by id DESC limit 0,1');
$lastfetch = mysql_fetch_object($lastid);
$custom = serialize(array("pg" => 1, "ty" => 1, "id" => $lastfetch->id));
$pay = new Paypal();
$currencyCode = 'USD';
$userdata = array('IPADDRESS' => $_SERVER['REMOTE_ADDR'], 'PAYMENTACTION' => 'Sale', 'CREDITCARDTYPE' => $cardType, 'DESC' => $desc, 'ACCT' => $cardNumber, 'EXPDATE' => $expMonth . $expYear, 'CVV2' => $cvv, 'FIRSTNAME' => $firstName, 'LASTNAME' => $lastName, 'EMAIL' => $email, 'SOFTDESCRIPTORCITY' => $email, 'COUNTRYCODE' => 'US', 'CITY' => $city, 'STREET' => $street, 'ZIP' => $zip, 'NOTIFYURL' => 'http://seobrand-dev.com/ipn.php', 'AMT' => $amount, 'CURRENCYCODE' => $currencyCode, 'CUSTOM' => $custom);
$payInfo = $pay->request('DoDirectPayment', $userdata);
echo json_encode($payInfo);
die;
Esempio n. 2
0
<?php

require 'paypalClass.php';
$paypal = new Paypal();
// Get Transaction Details
$response = $paypal->request('GetExpressCheckoutDetails', array('TOKEN' => $_GET['token']));
// $amount = $response['PAYMENTINFO_0_AMT'];
// echo '<pre>';
// print_r($_REQUEST);
// print_r($response);
// echo '</pre>';
// echo $_GET['token'];
// echo '<br>';
// echo $_GET['PayerID'];
// echo '<br>';
// Do transaction
$response2 = $paypal->request('DoExpressCheckoutPayment', array('TOKEN' => $_GET['token'], 'PAYERID' => $_GET['PayerID'], 'PAYMENTACTION' => 'Sale', 'PAYMENTREQUEST_0_AMT' => 5, 'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR'));
echo '<pre>';
print_r($_REQUEST);
echo '</pre>';
Esempio n. 3
0
$cCvv2 = $GLOBALS["card_cvv2"];
$bFName = $GLOBALS["bill_first_name"];
$bLName = $GLOBALS["bill_last_name"];
$bState = $GLOBALS["bill_state"];
$bCity = $GLOBALS["bill_city"];
$bAddr = $GLOBALS["bill_address"];
$bZip = $GLOBALS["bill_zip"];
$total = $GLOBALS["bill_total"];
$desc = $GLOBALS["bill_desc"];
$requestParams = array("IPADDRESS" => $_SERVER["REMOTE_ADDR"], "PAYMENTACTION" => "Sale");
$creditCardDetails = array("CREDITCARDDTYPE" => $cType, "ACCT" => $cNum, "EXPDATE" => $cExp, "CVV2" => $cCvv2);
$payerDetails = array("FIRSTNAME" => $bFName, "LASTNAME" => $bLName, "COUNTRYCODE" => "US", "STATE" => $bState, "CITY" => $bCity, "STREET" => $bAddr, "ZIP" => $bZip);
$orderParams = array("AMT" => $total, "ITEMAMT" => $total, "SHIPPINGAMT" => "0", "CURRENCYCODE" => "USD");
$item = array("L_NAME0" => "Venango Music Together", "L_DESC0" => $desc, "L_AMT0" => $total, "L_QTY0" => "1");
$paypal = new Paypal();
$response = $paypal->request("DoDirectPayment", $requestParams + $creditCardDetails + $payerDetails + $orderParams + $item);
if (is_array($response) && $response["ACK"] == "Success") {
    //Payment successful
    $transactionId = $response["TRANSACTIONID"];
    if ($response["ACK"] == "Success") {
        $responseId = 0;
    } else {
        if ($response["ACK"] == "SuccessWithWarning") {
            $responseId = 1;
        } else {
            if ($response["ACK"] == "Failure") {
                $responseId = 2;
            } else {
                if ($response["ACK"] == "FailureWithWarning") {
                    $responseId = 3;
                } else {
<?php

require 'paypalClass.php';
if (isset($_GET["amount"])) {
    $amount = $_GET["amount"];
    if ($amount <= 3) {
        $amount = 3;
    }
} else {
    $amount = 3;
}
$paypal = new Paypal();
$params = array('RETURNURL' => 'http://4l-front.dev/paypal/doCheckout.php', 'CANCELURL' => 'http://4l-front.dev/', 'PAYMENTREQUEST_0_AMT' => $amount, 'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR');
$token = $paypal->request('SetExpressCheckout', $params);
if ($token) {
    $url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=" . $token;
    // echo $token;
    header("Location: {$url}");
    exit;
}
Esempio n. 5
0
         case 'Day':
             $period = __('day', 'ait');
             break;
     }
     $recurringDescription = $rolePrice . ' ' . $currencyCode . ' ' . __('per', 'ait') . ' ' . $period;
     $recurringDescriptionFull = $rolePrice . ' ' . $currencyCode . ' ' . __('per', 'ait') . ' ' . $period . ' ' . __('for', 'ait') . ' ' . $packageName;
     // Recurring payments
     $recurring = array('L_BILLINGTYPE0' => 'RecurringPayments', 'L_BILLINGAGREEMENTDESCRIPTION0' => $recurringDescriptionFull);
     $params = $urlParams + $recurring;
 } else {
     // Single payments
     $orderParams = array('PAYMENTREQUEST_0_AMT' => $price, 'PAYMENTREQUEST_0_SHIPPINGAMT' => '0', 'PAYMENTREQUEST_0_CURRENCYCODE' => $currencyCode, 'PAYMENTREQUEST_0_ITEMAMT' => $price);
     $itemParams = array('L_PAYMENTREQUEST_0_NAME0' => $paymentName, 'L_PAYMENTREQUEST_0_DESC0' => $paymentDescription, 'L_PAYMENTREQUEST_0_AMT0' => $price, 'L_PAYMENTREQUEST_0_QTY0' => '1');
     $params = $urlParams + $orderParams + $itemParams;
 }
 $response = $paypal->request('SetExpressCheckout', $params);
 $errors = new WP_Error();
 if (!$response) {
     $errorMessage = __('ERROR: Bad paypal API settings! Check paypal api credentials in admin settings!', 'ait');
     $detailErrorMessage = array_shift(array_values($paypal->getErrors()));
     $errors->add('bad_paypal_api', $errorMessage . ' ' . $detailErrorMessage);
     $registerErrors = $errors;
 }
 // Request successful
 if (is_array($response) && $response['ACK'] == 'Success') {
     // write token to DB
     $token = $response['TOKEN'];
     update_user_meta($userId, 'ait_dir_reg_paypal_token', $token);
     update_user_meta($userId, 'ait_dir_reg_paypal_role', $role);
     // write recurring data
     if (isset($aitThemeOptions->members->paypalPaymentType) && $aitThemeOptions->members->paypalPaymentType == 'recurring') {