private function processCard() { //build the receipt $total = $this->receipt->getTotal(); //get list of prouct ids from order $products = ''; $del = ''; foreach ($this->receipt->getContentsByType(array('product')) as $entry) { $products .= $del . $entry->id; $del = '-*-'; } App::import('Lib', 'class_paypal'); try { //NEW METHOD USING CURL $txn = new PayflowTransaction(); $txn->environment = 'live'; //test or live //set up user/pass etc... $txn->PARTNER = 'verisign'; $txn->USER = '******'; $txn->PWD = 'will1480'; $txn->VENDOR = 'fcpackage'; $txn->TENDER = 'C'; //sets to a cc transaction $txn->ACCT = $this->data['card_number']; //cc number $txn->TRXTYPE = 'S'; //txn type: sale $txn->COMMENT1 = 'FlyFoenix.com transaction'; $txn->COMMENT2 = $products; $txn->AMT = $total * 1.0; //amount: 1 dollar $txn->EXPDATE = $this->data['card_exp_mm'] . $this->data['card_exp_yy']; //4 digit expiration date $txn->COUNTRY = 'US'; $result = $txn->process(); } catch (TransactionDataException $tde) { $msg = 'bad transaction data ' . $tde->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (InvalidCredentialsException $e) { $msg = 'Invalid credentials'; $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (InvalidResponseCodeException $irc) { $msg = 'bad response code: ' . $irc->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (AVSException $avse) { $msg = 'AVS error: ' . $avse->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (CVV2Exception $cvve) { $msg = 'CVV2 error: ' . $cvve->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (FraudProtectionException $fpe) { $msg = 'Fraud Protection error: ' . $fpe->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } catch (Exception $e) { $msg = $e->getMessage(); $this->redirect('/checkout/finalize/credit_processing_error/' . urlencode($msg)); } return $result; }
$txn->ACTION = 'A'; // Add, Modify, Cancel, Reactivate,Inquiry, or Payment $txn->PROFILENAME = $_POST["BillingFirstName"] . " " . $_POST["BillingLastName"]; // Use something unique and user-specific $start_recur_date = date("mdY", strtotime("+12 month")); $txn->START = $start_recur_date; //Format: MMDDYYYY $txn->TERM = 0; //0 means that payments should continue until the profile is deactivated $txn->PAYPERIOD = 'YEAR'; // Every 12 months on the same date as the first payment. /**/ /************************ END: Recurring Payment attributes. ************************/ $txn->process(); if ($txn->txn_successful == "1") { echo "|1|"; } /* echo '<pre>'; echo "success: " . $txn->txn_successful; echo " response was: " . print_r( $txn->response_arr, true ); echo '</pre>'; */ die; } catch (TransactionDataException $tde) { echo 'bad transaction data ' . $tde->getMessage(); } catch (InvalidCredentialsException $e) { echo 'Invalid credentials';