PHP Classes
Icontem

File: example_plug_n_pay.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Fabrizio Parrella  >  bibEC Process Card  >  example_plug_n_pay.php  
File: example_plug_n_pay.php
Role: Example script
Content type: text/plain
Description: this is a simple example for PlugNPay
Class: bibEC Process Card
Multiple gateway credit card payment processor
 

Contents

Class file image Download
<?php
$bibEC_ccp 
= new bibEC_processCard('plug_n_pay');
$bibEC_ccp->save_log($file);    // the name of a LOG FILE
$bibEC_ccp->set_user($cc_user$cc_password$cc_key$admin_email);
$bibEC_ccp->set_customer($fname$lname$address$city$state$zip$country$phone$fax$email);//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($name_on_card$type$number$expmm$expyy$cvv);
$bibEC_ccp->set_valuta('USD''$');
$bibEC_ccp->set_order($total_cart$order_number$description'auth'NULLNULLNULL);    //the last 5 fields are:
                                                                                            //    mode
                                                                                            //    authcode
                                                                                            //    transnum
                                                                                            //  currency code    //optional: there is a separate function now
                                                                                            //  currency simbol    //optional: there is a separate function now

//I am going to set extra fields if the gateway needs them

//$extra['ipaddress']    = $_SERVER['REMOTE_ADDR'];    //not necessary anymore from version 1.2.4
$extra['app-level']        = 1;        // ONLY FOR PLUG_N_PAY
                                    // 0 Anything Goes. No transaction is rejected based on AVS 
                                    // 1 Requires a match of Zip Code or Street Address, but will allow cards where the address information is not available. (Only 'N' responses will be voided) 
                                    // 2 Reserved For Special Requests 
                                    // 3 Requires match of Zip Code or Street Address. All other transactions voided; including those where the address information is not available. 
                                    // 4 Requires match of Street Address or a exact match (Zip Code and Street Address). All other transactions voided; including those where the address information is not available. 
                                    // 5 Requires exact match of Zip Code and Street Address.  All other transactions voided; including those where the address information is not available. 
                                    // 6 Requires exact match of Zip Code and Street Address, but will allows cards where the address information is not available. 
$bibEC_ccp->set_extra($extra);    //I need to pass an array

if(!$bibEC_ccp->process()){
    
print_r($bibEC_ccp->get_error());
} else {
    
//save the order!!!!
    //printing the authorization code
    
echo $bibEC_ccp->get_authorization();
    echo 
'HERE I HAVE TO SAVE THE CART, SEND EMAILS AROUND, DELETE CREDIT CARD INFO';
}
//if I want, I can print what I retrieve from the gateway

print_r($bibEC_ccp->get_answer());

print_r($bibEC_ccp->get_log());

//if I have a file with the LOG I can retrieve all the log with this :
print_r($bibEC_ccp->get_log_all());
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products