コード例 #1
0
 public function process($data, $config)
 {
     $user = $config['user'] != '' ? $config['user'] : $config['merchant_id'];
     $payflow = new PayFlow($config['merchant_id'], $config['partner_id'], $user, $config['password'], 'single');
     $environment = $config['sandbox'] == "TRUE" ? 'test' : 'live';
     $payflow->setEnvironment($environment);
     $payflow->setTransactionType('S');
     $payflow->setPaymentMethod('C');
     $payflow->setPaymentCurrency($this->_config["currency"]);
     $payflow->setAmount($data["order_total"], FALSE);
     $payflow->setCCNumber($data["payflow_cc_num"]);
     $payflow->setCVV($data["payflow_cc_code"]);
     $payflow->setExpiration($data["payflow_cc_month"] . $data["payflow_cc_year"]);
     $payflow->setCreditCardName($data["payflow_cc_name"]);
     $payflow->setCustomerFirstName($data["br_billing_fname"]);
     $payflow->setCustomerLastName($data["br_billing_lname"]);
     $payflow->setCustomerAddress($data["br_billing_address1"]);
     $payflow->setCustomerCity($data["br_billing_city"]);
     $payflow->setCustomerState($data["br_billing_state"]);
     $payflow->setCustomerZip($data["br_billing_zip"]);
     $payflow->setCustomerCountry($data["br_billing_country"]);
     $payflow->setCustomerPhone($data["br_billing_phone"]);
     $transaction = $payflow->processTransaction();
     $response = $payflow->getResponse();
     if ($transaction) {
         $trans = $this->create_order($data, $response);
     } elseif ($response['RESULT'] == '126' && $config['fraud_filters_actions'] == 'neworder') {
         $trans = $this->create_order($data, $response, 1);
     } else {
         $trans = array('error' => $response['RESPMSG']);
     }
     return $trans;
 }
コード例 #2
0
$PayFlow->setTransactionType('S');
// S = Sale transaction, R = Recurring, C = Credit, A = Authorization, D = Delayed Capture, V = Void, F = Voice Authorization, I = Inquiry, N = Duplicate transaction
$PayFlow->setPaymentMethod('C');
// A = Automated clearinghouse, C = Credit card, D = Pinless debit, K = Telecheck, P = PayPal.
$PayFlow->setPaymentCurrency('USD');
// 'USD', 'EUR', 'GBP', 'CAD', 'JPY', 'AUD'.
$PayFlow->setAmount('15.00', FALSE);
$PayFlow->setCCNumber('378282246310005');
$PayFlow->setCVV('4685');
$PayFlow->setExpiration('1112');
$PayFlow->setCreditCardName('Richard Castera');
$PayFlow->setCustomerFirstName('Richard');
$PayFlow->setCustomerLastName('Castera');
$PayFlow->setCustomerAddress('589 8th Ave Suite 10');
$PayFlow->setCustomerCity('New York');
$PayFlow->setCustomerState('NY');
$PayFlow->setCustomerZip('10018');
$PayFlow->setCustomerCountry('US');
$PayFlow->setCustomerPhone('212-123-1234');
$PayFlow->setCustomerEmail('*****@*****.**');
$PayFlow->setPaymentComment('New Regular Transaction');
$PayFlow->setPaymentComment2('Product 233');
if ($PayFlow->processTransaction()) {
    echo 'Transaction Processed Successfully!';
} else {
    echo 'Transaction could not be processed at this time.';
}
echo '<h2>Name Value Pair String:</h2>';
echo '<pre>';
print_r($PayFlow->debugNVP('array'));
echo '</pre>';