PHP Classes

File: example_viaklix.php

Recommend this page to a friend!
  Classes of Fabrizio Parrella   bibEC Process Card   example_viaklix.php   Download  
File: example_viaklix.php
Role: Example script
Content type: text/plain
Description: this is a simple example for ViaKLIX
Class: bibEC Process Card
Multiple gateway credit card payment processor
Author: By
Last change:
Date: 16 years ago
Size: 2,067 bytes
 

Contents

Class file image Download
<?php
       
include_once $_SERVER['DOCUMENT_ROOT'].'/includes/bibec_processcard/_class_processcard.php';
       
$bibEC_ccp = new bibEC_processCard('viaklix');
       
$bibEC_ccp->set_user($viaklix_cc_user, $viaklix_cc_password, $viaklix_cc_key, $admin_email);
       
$bibEC_ccp->set_customer($customer_info['firstname'],
                                
$customer_info['lastname'],
                                
$customer_info['billing_address_line_1']."\n".$customer_info['billing_address_line_2'],
                                
$customer_info['billing_city'],
                                
$customer_info['billing_state'],
                                
$customer_info["billing_zip"],
                                
'US',
                                
$customer_info['phone_area_code'].$customer_info['phone'],
                                
$customer_info['fax_area_code'].$customer_info['fax'],
                                
$customer_info['emailaddr']);//can be passed the IP as last field, optional
// $bibEC_ccp->set_ship_to($fname, $lname, $address, $city, $state, $zip, $country, $phone, $fax);
       
$bibEC_ccp->set_ccard(ucwords($billing_name), $cctype, $cc_info['ccnum'], $cc_info['ccexp_mm'], $cc_info['ccexp_yyyy'], $cc_info['cccvv']!=''?$cc_info['cccvv']:NULL);

       
$bibEC_ccp->set_valuta('USD', '$');
       
$bibEC_ccp->set_order($customer_order_info['grand_total'], $customer_order_info['id'], 'Order number '.$customer_order_info['id'], 'auth', NULL, NULL, NULL);
       
//I am going to set extra fields if the gateway needs them
       
$extra['ssl_cvv2'] = $cc_info['cccvv']!=''?'Present':'Bypassed';
       
$bibEC_ccp->set_extra($extra); //I need to pass an array
       
       
if(!$bibEC_ccp->process()){
           
$error = $bibEC_ccp->get_error();
            echo
$error['text'].'('.$error['number'].')<br />';
            echo
'The gateway is saying: '.$error['gerror'].'('.$error['gnumber'].')<br /><br />';
           
$card_success = false;
        } else {
           
$gateway_note = "charged_by = '$QSC2_userid', AUTHCODE='" . $bibEC_ccp->get_authorization() . "', transaction_date='" . gmdate("Y") . "-" . gmdate("m") . "-" . str_pad(gmdate("d"),2,"0",STR_PAD_LEFT) . " " . gmdate("H") . ":" . gmdate("i") . ":" . gmdate("s") . "', transaction_amount='$grand_total'";
           
$card_success = true;
        }
?>